MediaRouterProvider not visible in the network

a 夏天 提交于 2019-12-11 05:53:15

问题


I created a SampleMediaRouteProvider as given in https://github.com/googlesamples/android-MediaRouter. In this sample there is also a MediaRouter that discovers all MediaRouteProviders in the network. This SampleMediaRouteProvider is visible in the same device to other apps but its not visible to apps on other device in the same network.

Can you please help me to get MediaRouteProvider visible in wifi network. Iam looking to create a MediaRenderer on a Android device that I could use to cast audio from other Android devices.


回答1:


MediaRouteProvider doesn't really do what you're asking.

The MediaRouteProvider, which you've written, has the role of allowing apps on your phone - device A - to find other devices on the network (device B or C). Device B and C can play the media you have on device A. Device A might stream/mirror directly (say to device B) or 'cast' (say to device C).

When mirroring, you send the audio content out of device A to device B. When casting, you only send a URL to device C, for example, the link to a video on youtube.com. And device C goes directly to the source to get the content.

I think you will need to:

  • Put your MediaRouteProvider on every device.
  • Implement a discovery mechanism
    • for example, based on using SSDP, mDNS, etc.
    • have your mediarouter implmenent discovery
  • Implement a webserver on the device(s) with content
    • or use something like nanohttpd
  • Now Write your MediaRenderer


来源:https://stackoverflow.com/questions/39131973/mediarouterprovider-not-visible-in-the-network

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!