문제

Any Idea of how to make DLNA projection of photos onto any smart TVs through Android Application?

도움이 되었습니까?

해결책

you will need two components:

  • a DLNA-capable upnp stack (such as cling)
  • a very simple embedded webserver (I recommend writing this yourself, you'll soon see why)

The steps go like this, pretty much regardless of what is your stack implementation:

  1. start device discovery inside the upnp stack and wait a moment to see which rendered devices can be found on the network
  2. check which of the devices are capable of playing images (from the device capabilities) and let user select one of those
  3. from the selected device, use the transport service and rendering service
  4. using the transport service, call setTransportUri with a URI with your own selection. just the IP address needs to point to your own device, buth the path that follows can be anything.
  5. the remote renderer will issue a HTTP GET request for the URI you gave.
  6. the HTTP GET request is auto-forwarded to your own mini-webserver, which should by now be listening to the port you provided.
  7. now make sure that the incoming HTTP GET URI matches the URI you gave in setTransportURI. For security reasons you should ignore all other HTTP GET URI's, and all other types of HTTP requests. If it matches, return the content of the file to the renderer. Here you can use some class library of your own preference.
  8. Now you wait setTransportURI to be completed. This can be done by observing the transport service's transportUri state attribute.
  9. now you call play in the rendering service (and wait until the state attribute becomes playing, if you want to be sure the state transition occurred)
  10. that's it, the image is shown on the renderer!
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top