google-castgoogle-cast-sdk

Determining which generation of Chromecast the is being used


I am trying to find if there is an official way to determine the device which is being cast to using the Cast SDK. According to the documentation it appears that "No" is the correct answer.

There is an unofficial way to determine this in How to detect chromecast model in receiver? which was asked in 2017 and answered in 2020 but I would like to ensure that there hasn't been any changes since then.


Solution

  • There is no change in that. You can use canDisplayType or getDeviceCapabilities to determine whether it supports or not.

    https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.CastReceiverContext?hl=en#canDisplayType

    https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.CastReceiverContext?hl=en#getDeviceCapabilities