Android Xamarin多平台-来自jpeg序列的视频
我想知道如何在Xamarin(所有平台)中显示JPEG格式的视频 我的JPEG是从一个流行的视频监控管理软件发送的http客户端流传输的 我的JPEG格式为字节[],每秒大约10个JPEG。这种形式是强制性的 我尝试在图像上快速更改源代码,但结果在Android上出现了严重的Fliquer。这在Windows phone上似乎有效,但性能不太好 如何为每个视频播放器创建视频播放器?除非我被绞死,否则现有的组件无法做到这一点Android Xamarin多平台-来自jpeg序列的视频,android,ios,xamarin,windows-phone,mjpeg,Android,Ios,Xamarin,Windows Phone,Mjpeg,我想知道如何在Xamarin(所有平台)中显示JPEG格式的视频 我的JPEG是从一个流行的视频监控管理软件发送的http客户端流传输的 我的JPEG格式为字节[],每秒大约10个JPEG。这种形式是强制性的 我尝试在图像上快速更改源代码,但结果在Android上出现了严重的Fliquer。这在Windows phone上似乎有效,但性能不太好 如何为每个视频播放器创建视频播放器?除非我被绞死,否则现有的组件无法做到这一点 最好的,谢谢你,杰森!效果非常好,渲染非常流畅 只需将带有NuGet的S
最好的,谢谢你,杰森!效果非常好,渲染非常流畅 只需将带有NuGet的SkiaSharp.Views.Forms添加到项目中,瞧 下面是代码(共享项目)中的内容:
您可以尝试使用SkiaSharp显示它们,这将允许您在屏幕外画布上绘制,然后显示图像,这可能有助于您在其他平台上测试的闪烁效果?只有在安卓设备上它才会flick?Grace,我在Windows phone上测试过,一切正常。没有在IOS上测试,但很有可能它不会闪烁。
// Content page initialization
private void InitUI() {
Title = "Xamavideo";
var button = new Button
{
Text = "Connect!"
};
Label label = new Label
{
Text = ""
};
var scroll = new ScrollView();
scroll.BackgroundColor = Color.Black;
Content = scroll;
var stack = new StackLayout
{
Padding = 40,
Spacing = 10
};
//Add a SKCanvasView item to the stack
var videoCanvas = new SKCanvasView
{
HeightRequest = 400,
WidthRequest = 600,
};
videoCanvas.PaintSurface += OnCanvasViewPaintSurface;
stack.Children.Add(videoCanvas);
}
//Create the event handler
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
{
SKImageInfo info = args.Info;
SKSurface surface = args.Surface;
// using (var stream = new SKManagedStream(fileStream))
if (lastFrame == null) return;
using (var canvas = surface.Canvas)
// use KBitmap.Decode to decode the byte[] in jpeg format
using (var bitmap = SKBitmap.Decode(lastFrame))
using (var paint = new SKPaint())
{
// clear the canvas / fill with black
canvas.DrawColor(SKColors.Black);
canvas.DrawBitmap(bitmap, SKRect.Create(640, 480), paint);
}
}
void UpdateFrame(VideoClient client){
//Use this to update the canvas:
byte[] lastFrame = client.imageBytes;
videoCanvas.InvalidateSurface();
}