Search code examples
javascriptchromecastgoogle-castgoogle-cast-sdk

How to detect loading of unsupported caption tracks in Chromecast SDK


What's the best practice way to detect when an unsupported caption track is loaded (ie, a dfxp caption track)?

Options I'm trying to avoid:

  • Filter by MIME type before sending to chromecast (many of our clients' servers do not properly type response headers).

  • Filter by extension before sending to chromecast (Similar issue as with above).

Are there any methods or events native to the SDK that simulate when an unsupported track is loaded?


Solution

  • You can use canDisplayType API: https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.CastReceiverContext#canDisplayType

    I would recommend to go through the supported media: https://developers.google.com/cast/docs/media#top_of_page