ActiveApathy
ActiveApathy

Reputation: 1211

How can I programmatically disconnect from a selected route?

I'm using a MediaRouteButton to connect to a ChromeCast device. Once a user is connected they can click on the MediaRouteButton to disconnect, but I would like to place another specific disconnect button in the UI. I've been searching for a way to programmatically disconnect from the selected route, but I can't seem to find anything.

Upvotes: 3

Views: 1139

Answers (1)

Ali Naddaf
Ali Naddaf

Reputation: 19094

If you are using the MediaRouteHelper, you don't have access to the piece that you are looking for. You can extend MediaRouter and do all the discovery related stuff yourself and then you'll have access to what you want. That said, I strongly recommend not to provide a second mechanism for deselection of a route; we strongly urge developers to use the standard way that we have built. People may not yet be fully familiar with this relatively new approach to select a device and cast content to them but as more and more apps use that, it will become very familiar. Since popular Google apps also use that (e.g. YouTube or Play Movie or Play Music), then a lot of people will learn about that quickly.

Upvotes: 2

Related Questions