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?
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.
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.
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.”
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."
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With