我有一个设备可以从如下 URL 提供 H.264 视频流: rtsp://192.168.0.10:554/videoservice
由于这是实时视频,我不需要控制它(暂停、倒带等),只需播放即可。 MediaElement 支持吗?或其他标准类(class),我需要类似 Smooth Streaming Client SDK 的东西吗?还是这比我想象的要复杂得多?
更新: 我下载了微软的Player Framework但这也不会播放流。我在有关 RTSP 的示例中找不到任何内容。
更新: 我用了Wireshark比较 VLC Media Player 的数据包(有效)使用 MediaElement 和 Player Framework 发送,它们似乎都没有使用 RTSP 协议(protocol)。相反,他们发送 WPAD数据包到不同的地址,即使我已经提供了源的 IP 地址。为什么这是必要的?有什么办法可以关闭此行为吗?
最佳答案
查看帖子 here .您需要将数据包装在 MPEG-4 Part 14 容器中,然后将它们传递到 MediaElement.SetSource
中。 .看来您不能仅使用记录的 API 来执行此操作。以下是链接中的重要信息:
We don't support RTP but rather the MPEG-4 Part 14 container format. You will need to write our own source to be able to parse the data a pass it directly to the Microsoft decoder. At this time we do not have any samples on how to write a custom source and have it loaded from your Metro style app. Unfortunately it is not possible to simply use the documentation to figure out how to do this. I have been talking with Stan and we are trying to figure out how and when we can make this information available. As soon as this information is available I will announce it on my blog http://blogs.msdn.com/mediasdkstuff/.
Here是支持的视频格式列表。
还有一个例子here如何扩展媒体类,其中可能有一个示例,说明如何执行与您所要求的类似的操作。
还有一个类似的例子here .
关于c# - 如何在 Windows 8 Metro C# XAML 应用程序中播放 H.264 RTSP 视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12994188/