Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i programatically detect if there are any Chromecast devices on the current WiFi network?

Is it possible to detect if there are any Chromecast devices on the current WiFi network. I've seen that there's a Cast SDK but I couldn't find anything about searching for devices. Having never worked with this SDK before, it is possible that I may have overlooked it.

like image 916
Mridang Agarwalla Avatar asked Apr 22 '14 13:04

Mridang Agarwalla


People also ask

How do I know which Chromecast is mine?

Select Devices in the top-right corner. Select the 3-dot menu for the Chromecast itself. Select Settings. Near the top, you'll see the name of your Chromecast, and just below you'll see which Wi-Fi network it's connected to.

Can other people on my network see what Im casting?

It's more likely that you're seeing a notification that somebody is streaming something over Chromecast on your wifi network. It's harmless, they can't see anything on your phone. How do I get access to another phone's content from mine, when they are signed into my Wi-Fi?

How do I hide Chromecast on network?

You can make your Chromecast private by switching off Guest Mode. Use the Google Home App to toggle Guest Mode off by clicking on Account, Devices, then Guest Mode.


2 Answers

Chromecast devices are discoverable using avahi with the type _googlecast._tcp

$ avahi-browse -r _googlecast._tcp
+   eth0 IPv4 Living Room                                   _googlecast._tcp     local
=   eth0 IPv4 Living Room                                   _googlecast._tcp     local
   hostname = [Living\032Room.local]
   address = [192.168.1.100]
   port = [8009]
   txt = ["st=0" "fn=Living Room" "ca=5" "ic=/setup/icon.png" "md=Chromecast" "ve=02" "id=c832a30b81ab84a706c82745438fcd64"]
like image 134
hardillb Avatar answered Sep 22 '22 14:09

hardillb


You can perform discovery without using the cast button; you need to use media router from v7 support library (which needs the v7 appcompat support as well) and then get an instance of the media router from your code, define a selector (which is basically a filter to possibly narrow down the devices that you are interested in) and then add a callback to start discovery. As devices are discovered (asynchronously), your callbacks will be called. Take a look at this sample project, specially this class which does exactly what you want.

like image 29
Ali Naddaf Avatar answered Sep 20 '22 14:09

Ali Naddaf