ChromeCast doesnt play HLS in .m3u8 format

2020-05-03 11:44发布

问题:

Integrated chromecast in the app. Everything works fine except it does not play live streaming url which is in .m3u8 format but plays .m3u8 format url for movies. I am doing this to set url to chromecast.

return new MediaInfo.Builder(url)
            .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
            .setContentType("videos/mp4")
            .setMetadata(movieMetadata)
            .setStreamDuration(mVideoView.getDuration())
            .build();

回答1:

According to google Cast Samples, needed MIME Types are shown in json file https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/f.json

{
    "type": "hls",
    "mime": "application/x-mpegurl",
},
{
    "type": "dash",
    "mime": "application/dash+xml",
},
{
    "type": "mp4",
    "mime": "videos/mp4",
}