简体   繁体   English

C#DLNA / UPNP媒体播放

[英]C# DLNA/UPNP Media Playback

I'm trying to stream specific media to dlna/upnp compliant devices. 我正在尝试将特定媒体流式传输到dlna / upnp兼容设备。 I already found out how to send commands to devices using c#(eg play, pause, stop etc.). 我已经了解了如何使用c#向设备发送命令(例如播放,暂停,停止等)。

So, i can play media on a device. 所以,我可以在设备上播放媒体。 However, it's unclear to me how i tell the device what media to play. 但是,我不清楚我如何告诉设备播放什么媒体。 Is there a certain command for this? 这有什么命令吗?

I saw the "SetAVTransportURI" command but this takes a uri, i just want to play a video file from a shared directory on my network. 我看到了“SetAVTransportURI”命令,但这需要一个uri,我只想从我网络上的共享目录中播放视频文件。 How do i tell the device which media to play? 我如何告诉设备播放哪种媒体?

Per UPnP MediaRenderer spec (it's public, look up at www.upnp.org ), AVTransport service is expected to take URI scheme file: only for internal protocol, which is largely unspecified and device specific (as written in the spec). 根据UPnP MediaRenderer规范(它是公开的,请查阅www.upnp.org ), AVTransport服务应该采用URI方案file:仅用于内部协议,这在很大程度上是未指定的和设备特定的 (如规范中所述)。 In other words, you are allowed to SetAVTransportURI with file: only for things like "1st track on CD" or "Tuner station X". 换句话说,您可以使用file:设置SetAVTransportURI file:仅适用于“CD上的第一首曲目”或“调谐器电台X”等内容。 If you want remote connection, you must use protocol http-get , that is URI scheme http: . 如果要进行远程连接,则必须使用协议http-get ,即URI方案http: . Setting up a simple webserver which will publish your shared directory should do the trick. 设置一个简单的Web服务器将发布您的共享目录应该可以解决问题。

For this isolated part of UPnP (that is setting single , already known media URI, no browsing and no metadata like video name etc.) you don't need your server to know any special DLNA/UPnP services. 对于UPnP的这个孤立部分(即设置单个已知的媒体URI, 没有浏览没有视频名称等元数据 ),您不需要服务器知道任何特殊的DLNA / UPnP服务。 As soon as you would like to have better-than-none user experience, look up some full blown UPnP MediaServer. 只要您希望获得更好的用户体验,请查看一些完整的UPnP MediaServer。 There are some written in C# too. 还有一些用C#编写。

Check the wikipedia entry for the URI scheme on Windows. 检查wikipedia条目以获取Windows上的URI方案
Does your shared network directory also provide DLNA/UPNP services? 您的共享网络目录是否也提供DLNA / UPNP服务? Edit:In case there no UPNP service, you may look at this question regarding UPNP server functionality. 编辑:如果没有UPNP服务,您可以查看有关UPNP服务器功能的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM