How to get MediaRouteSelector to show available MiraCast and Chromecast devices?

I am trying to configure Media Route Selector to show MiraCast and Chromecast devices. I have a Chromecast recipient application, as well as using the Presentation API in Android, so ideally, the user only needs to press the media router button and select the device that they have without even thinking about it. I followed this guide ( https://developer.android.com/guide/topics/media/mediarouter.html#selector ) to achieve this, and in the picture it shows both the Chromecast and the wireless display available in the route selector . However, after adding management categories, I still only see Chromecast.

Here is the relevant code.

mMediaRouteSelector = new MediaRouteSelector.Builder()
                .addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
                .addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
                .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
                .addControlCategory(CastMediaControlIntent.categoryForCast(CAST_APP_ID))
                .build();

...

mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
                MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);

, .

EDIT:

factory , , . , , , , , .

+3

Source: https://habr.com/ru/post/1545453/


All Articles