Search code examples
androidhttp-live-streamingchromecast

How to play hls from android sender to chromecast


I am trying to play HLS stream on Chromecast via android sender. Chromecast by this link need to support HLS streams: https://developers.google.com/cast/docs/media

I imported library CastCompanionLibrary-android and changed project CastVideos-android by adding TestCastHlsActivity. Stream is working on local media player but when I try to send to chromecast load failed. mRemoteMediaPlayer.load callback return fail with result.getStatus().getStatusCode()=1 on line https://github.com/googlecast/CastCompanionLibrary-android/blob/master/src/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java#L1066

Can you please provide me right code snippet how to play hls from android sender to chromecast or way how to debug whats going wrong with loading hls stream on chromecast?


Solution

  • To see what is happening on the chromecast device (which is the right place to look at), you need to have your device whitelisted and then connect your chrome debugger to it on port 9222 and see what type of error you are getting. A very common error is not having the right CORS header settings on the content server side.

    Also make sure to turn on debug log: cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);

    If you are using a styled or default receiver, then you can issue that command in the debugger's console right after you launch your app.