Microsoft.PlayerFramework无法传输.mjpg文件

时间:2013-11-11 09:49:44

标签: windows-store-apps

的xmlns:视频流= “使用:Microsoft.PlayerFramework”

VideoStream:MediaPlayer Source =“http://155.41.145.37/mjpg/video.mjpg”

当我更改Source指向.mp4文件时工作正常。当改为.mjpg时,它将无法工作。运行时显示错误“此视频无法播放”。

请帮忙

Vishnu Aravind

1 个答案:

答案 0 :(得分:0)

这有效:

Doc:https://channel9.msdn.com/coding4fun/articles/MJPEG-Decoder

下载: http://mjpeg.codeplex.com/

示例代码:

MjpegDecoder _mjpeg;

public MainPage()
{
    this.InitializeComponent();

    _mjpeg = new MjpegDecoder();
    _mjpeg.FrameReady += mjpeg_FrameReady;

    _mjpeg.ParseStream(new Uri("http://155.41.145.37/mjpg/video.mjpg"));
}

private async void mjpeg_FrameReady(object sender, FrameReadyEventArgs e)
{
    // Convert IBuffer to IRandomAccessStream.
    var ras = new InMemoryRandomAccessStream();
    await ras.WriteAsync(e.FrameBuffer);
    ras.Seek(0);

    // Show image.
    var bitmap = new BitmapImage();
    await bitmap.SetSourceAsync(ras);
    image.Source = bitmap;
}