MediaElement有时会播放mp4流 [英] MediaElement SOMETIMES plays mp4 stream

查看:87
本文介绍了MediaElement有时会播放mp4流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我使用MediaElement(Windows 7上的.net framework 4 Beta 2)播放和mpeg 4流.流源是AXIS网络摄像机,该流在WMP中可以完美播放.

在我的MediaElement中,流也只播放一次,但每次播放一次.如果它不起作用,则在StreamOpened事件之后立即激发StreamEnded事件,结果是我看到了第一帧的静止图像.

代码很简单:
- xaml是一个在LayoutRoot网格中具有mediaElement的窗口
-Unloaded和LoadedBehaviour都设置为手动.
-IP_adr是摄像机的IP地址(我刚刚隐藏此帖子)

Hello,

Im using a MediaElement (.net framework 4 Beta 2, on Windows 7) to play and mpeg 4 stream. The stream source is an AXIS network camera, the stream plays perfectly in WMP.

In my MediaElement the stream is also played but only once every few times. When it does not work the StreamEnded event is fired right after the StreamOpened event, the result is that I see a still image of the first frame.

The code is straightforward:
 - the xaml is a window with a mediaElement in the LayoutRoot Grid
 - the Unloaded and LoadedBehaviour are both set to manual.
 - IP_adr is the IP address of the camera (which I've just hidden for this post)

public MainWindow()

{

      InitializeComponent();

      Uri ur = new Uri("axrtsphttp://IP_adr/mpeg4/media.amp");

      mediaElement1.MediaEnded += new RoutedEventHandler(mediaElement1_MediaEnded);

            

      mediaElement1.MediaOpened += new RoutedEventHandler(mediaElement1_MediaOpened);

      mediaElement1.Source = ur;

      mediaElement1.Play();



}

这是media元素中的错误,还是我必须告诉media元素这是一个永无止境的流,它需要一直播放直到我停止它为止.

Is this a bug in the media Element or do I have to tell the media element that this is a never ending stream, and that it needs to keep on playing untill I stop it.

推荐答案

您正在调用"mediaElement1.Close()"吗?在你
Are you calling "mediaElement1.Close()" in you
mediaElement1_MediaEnded


Method?


这篇关于MediaElement有时会播放mp4流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆