Starting point: A lot of DLNA/UPNP protocol stacks, CyberLink for Java (sourceforge download) Advantages: Simple and practical, the disadvantage is inefficient, there are several fatal bugs
Objective: To solve the problem that the DLNA player/server can not be found by other control points, why the media files in the media server can not play CyberLink.
Practice: The SSDP protocol implemented by Media renderer requires periodic packet-sending, telling other devices within the LAN that he is online and needs to include the following code for multicast rights:
Add a call to the following code in the OnCreate () method [Java] view plain copy multicastlock multicastlock; private void allowmulticast () { wifimanager wifimanager= (WifiManager) Getsystemservice (context.wifi_service); Multicastlock=wifimanager.createmulticastlock ("Multicast.test"); multicastlock.acquire (); } The
OnDestroy () method invokes the following code [Java] view plain copy private void releasemultcast () { multicastlock.release (); }