0

I have setup a custom Cast Dialog and added it using:

castButton.setDialogFactory(new DialogFactory());

My custom dialog retrieves available cast devices using the below code and display them as a list

MediaRouter.getInstance(getContext()).getRoutes();

How can I start casting to a CastDevice chosen from the above list?

TareK Khoury
  • 12,721
  • 16
  • 55
  • 78

1 Answers1

0

Solved using:

MediaRouter.getInstance(context).selectRoute(route)

To disconnect I did:

MediaRouter.getInstance(context).unselect(MediaRouter.UNSELECT_REASON_DISCONNECTED)

TareK Khoury
  • 12,721
  • 16
  • 55
  • 78