Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect a chromecast device in Javascript

Tags:

google-cast

The app I'm writing will behave differently if it detects that its host is not a chromecast device. What javascript code would determine whether or not it is running on a chromecast device?

like image 633
mikaye Avatar asked Jan 01 '14 20:01

mikaye


People also ask

How do I find Chromecast devices?

Power on your Chromecast device. Turn on Bluetooth on your Android device. If there is a nearby Chromecast device that hasn't been set up, you'll see a Chromecast setup notification pop up on your Android device. To begin setting up your Chromecast device, tap Set up a nearby Chromecast device.

Why can't Chromecast detect?

Troubleshooting stepsTurn Wi-Fi off/on from the setup device, then reopen the Google Home app. If this did not resolve the issue, continue to next step. Try using another device to set up the Chromecast device. If this did not resolve the issue, continue to next step.

How do I hide my Chromecast from other devices?

Open the Google Home app on your Android smart device. Tap open your Chromecast device. Tap the Settings icon on the top right corner of the screen. Disable “Let others control your cast media.”


2 Answers

Currently, you can check for presence of "CrKey" in the user agent of the browser. I have opened an issue through Google's issue tracker regarding this. I would suggest you star that issue to be notified of Google's response.

EDIT: Google's response: "Currently that is the way to do it."

like image 116
Jeremy White Avatar answered Sep 20 '22 01:09

Jeremy White


Try inspecting the user agent of the browser; search for CrKey" and "TV" and if you get a match for both of them, most likely it is a Chromecast device.

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

Ali Naddaf