Skip to content Skip to sidebar Skip to footer

How Can I Get List Of All Cast Devices Using Cast Sdk?

I am struggling to get list of all chrome cast devices available in my network, I am able to make it work with there default implementation of adding a media router button in the a

Solution 1:

    MediaRouter router = 
    MediaRouter.getInstance(a context);
    List<MediaRouter.RouteInfo> routes = router.getRoutes();

    List<CastDevice> devices = new ArrayList<>();

    for (MediaRouter.RouteInfo routeInfo : routes) {
        CastDevice device = CastDevice.getFromBundle(routeInfo.getExtras());
        if (device != null) {
            devices.add(device);
        }
    }

Post a Comment for "How Can I Get List Of All Cast Devices Using Cast Sdk?"