Home » Android » java – Implementing DLNA/UPnP (Win7 Play To) on a mobile device

java – Implementing DLNA/UPnP (Win7 Play To) on a mobile device

Posted by: admin June 15, 2020 Leave a comment


For a semester project, I had the idea to implement Windows 7’s Play to infrastructure to either use a phone as the end point (the player) or to stream stuff from the phone to a Windows 7 machine. Does anybody have experience working with this API? Is this do able over a couple of weeks (prototype, just proof of concept, not end-user ready) or is it too much for a project of this scope? Note: I’m not looking for code samples, just an assessment of the feasibility of this project. If you have any documentation from MS or otherwise that would be awesome although not the crux of the question.

Edit: I discovered that the Windows 7 Play-to functionality is based on DLNA and any device supporting DLNA (I think) can be used as a destination for the Play-To context menu. However, I’m having a really difficult time finding any sort of documentation on DLNA. I’m wondering if you need to be a member of the DNLA to actually get access to the spec? Alternatively, I know DLNA is built on UPnP, it wouldn’t exactly do what I want, but it would be a step in the right direction, so, to revise my question does anybody know of any open-source C/C++ or Java (preferable) libraries that would help me implement UPnP or DLNA?


How to&Answers:

The PlayTo is all UPnP based. DLNA is just a layer of standardization on top of UPnP. So any UPnP device is able to talk with a DLNA device so to a Win7 machine.
DLNA specifies 4 type of devices: DMP, DMR, DMC and DMS.
A DMP (aka Digital Media Player) is a device, that is capable of finding and browsing remote servers (DMS=Digital Media Servers) and consume content (or pull content). PS3 is the perfect example of DMP. A DMP is not discoverable on the network, it just discovers and consumes content. Because it is not discoverable, you cannot control it with PlayTo.
A DMR (aka Digital Media Renders) is a device that can accept commands received from the network. It is discoverable, exposes an UPnP description document and UPnP services like AVTransport and ConnectionManager or RenderingControl. A PlayTo device, is capable to find this device on a network, and it can push content to it. It can control the playback via AVTransport service and RenderingControl service.
Many devices today are either 100% DMPs (cannot be controlled via PlayTo) or DMP-DMRs. That means they both expose the AVTransport and RenderingControl services but also have a GUI that the user can use to pull media from a server.
A DMS (aka Digital Media Server) is a media server device. You can store media content in there and than you can consume it from other network devices. These are usually NAS devices, but they may also be mobile phones, Win7/Vista machines, etc. A DMS is discoverable on the network and exposes UPnP services as ContentDirectory service. This exposes methods as Browse and Search, which you may use to locate the content.
A DMC device (aka Digital Media Controller) is a device that has no playback capabilities. It has only controlling capabilities, and it needs a remote DMS (to expose the content) and a remote DMR (to play the content) for completing the media experience. PlayTo is an example. There are also similar apps on Nokia N95/Nokia N78 phones or on iPhone. Twonky has a web based DMC also.

All these devices have one thing in common: they understand and speak UPnP. They may be implemented in C+, C#, Java, they may run on Windows, Linux or Apple platform but they are all UPnP based. So all you need to do is to get familiar with UPnP standard. I would recommend downloading the papers from upnp.org and the Intel Device Spy (and other related Intel UPnP tools) and start playing with those.
If you want to write a DMC (or PlayTo) – which is the easiest thing to do – all you need to understand is just some basic UPnP concepts (SOAP, XML, network discovery, etc). If you want to write your app on top of Win7 platform, you may want to use the Win UPnP API to discover the devices and send commands to them. Or you can write your own API for doing that (it is not that hard). I do not know on the phone what API you may use. However, you can always go to the basic: sending SOAP messages over the wire using basic network APIs.
For a DMP/DMR, you will need playback capabilities, and that may depend on the platform and what codecs you have there.

Let me know if this helps a bit to get you started.