Question

I am using the latest version of the Chrome Sender (v1 of the new public release) and I am running into issues getting HLS to work.

My m3u8 manifest is a "master" playlist that points to six other m3u8 playlists of various resolutions and bitrates in order to provide adaptive bitrate streaming as per the spec.

This playlist is well tested in works in my custom Roku app, my iOS app (with Apple TV as well), and even in the browser via Flash (JWPlayer Pro). It also works directly in Safari on iOS. The only thing that is a little different about my playlists is that they contain query string parameters that enforce an expiration of the content but this is allowed in the HLS spec. For example: playlist.m3u8?expires=1391662909&signature=I3G8RKUkILOwxjZy8EyL5w%3D%3D%24q0WbXA2whSNFAj0Os3NIpfHkqMA%2BH2iqMMjm0xH2CYKNe3jh1jgl%2FUdS39ve%0AFnL%2F

Here is the code in my Chrome Sender where I am setting the playlist URL:

var mediaInfo = new chrome.cast.media.MediaInfo('http://master_playlist_url.m3u8');
mediaInfo.contentType = 'application/x-mpegURL';

var request = new chrome.cast.media.LoadRequest(mediaInfo);
request.autoplay = true;
request.currentTime = 0;

session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);

The media does not load and onMediaError is invoked with an error object containing the following:

code: "session_error"
description: "LOAD_FAILED"
details: null

I've also tried setting streamType to chrome.cast.media.StreamType.BUFFERED, chrome.cast.media.StreamType.LIVE, and chrome.cast.media.StreamType.OTHER each with the same result. I have also tried setting duration with no luck. I tried removing autoplay and currentTime on LoadRequest but no luck either.

My receiver is a basic Custom Receiver as follows:

<html>
<head>
  <title>Cast</title>
  <script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
</head>
<body>
  <video id='media' width="100%" height="auto" />
  <script>
    window.onload = function() {
      window.mediaElement = document.getElementById('media');
      window.mediaManager = new cast.receiver.MediaManager(window.mediaElement);
      window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
      window.castReceiverManager.start();
    }
  </script>
</body>
</html>

According to the updated docs HLS is now supported but I can't seem to get it to work: https://developers.google.com/cast/docs/media

I should also mention this code works fine when using a progressive MP4 and changing the content type to video/mp4.

UPDATE: I decided to try removing the master playlist (adaptive bitrate streaming) from the mix and just go with a single m3u8 playlist that contains one quality of TS segments. It produced the same exact error. So at least we know the problem isn't related to adaptive bitrate streaming specifically but the entirety of HLS support.

Was it helpful?

Solution

Adaptive BitRate protocols need the Media Player Library. Take a look at either the Cast Media Player Library Sample or the Cast Custom Receiver samples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top