简体   繁体   中英

C# DLNA/UPNP Media Playback

I'm trying to stream specific media to dlna/upnp compliant devices. I already found out how to send commands to devices using c#(eg play, pause, stop etc.).

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. 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). In other words, you are allowed to SetAVTransportURI with file: only for things like "1st track on CD" or "Tuner station X". If you want remote connection, you must use protocol http-get , that is URI scheme http: . Setting up a simple webserver which will publish your shared directory should do the trick.

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. As soon as you would like to have better-than-none user experience, look up some full blown UPnP MediaServer. There are some written in C# too.

Check the wikipedia entry for the URI scheme on Windows.
Does your shared network directory also provide DLNA/UPNP services? Edit:In case there no UPNP service, you may look at this question regarding UPNP server functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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