问题
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