首页 > 解决方案 > 如何从 http 套接字发送 Memorystream

问题描述

我有一个 VB WinForms 应用程序,我从某个地方得到了框架。应用程序不是我开发的。

_ImageList = New Queue(Of MemoryStream)

Dim bmpdecode As New Bitmap(nWidth, nHeight)
Dim ms As New MemoryStream

bmpdecode.Save(ms, Imaging.ImageFormat.Jpeg)

_ImageList.Enqueue(ms)

PictureBox1.BeginInvoke(New DelPintarImagen(AddressOf DrawImage), New Object() {bmpdecode})

DrawImage是位图类型。

我想要的是从 Xamarin android 应用程序VideoViewImageView我看到的PictureBox1

经过几天的研究,我无法找到任何最低限度的工作。

我可以在网络浏览器中通过 http 看到流,但我无法从任何VideoViewImageView.

标签: vb.netwinformsxamarinmemorystream

解决方案


我有一个解决方案,它很简单,但很有效。

我使用 aWebView在我的 Xamarin 应用程序中显示流,禁用缩放选项,因此对于用户来说,它看起来像是在播放流。

C#代码:

var wPlayer = FindViewById<WebView>(Resource.Id.webView1);
//Zoom Out for stretch the content by the width. 
wPlayer.Settings.LoadWithOverviewMode = true; 
wPlayer.Settings.UseWideViewPort = true;

wPlayer.SetPadding(0, 0, 0, 0);

wPlayer.LoadUrl("http://ip:port/?params");

xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">

<android.webkit.WebView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/webView1"
/>


</RelativeLayout>

推荐阅读