1

I have an m3u8 file that looks like this:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=2048805,CODECS="avc1.66.31,mp4a.40.2",RESOLUTION=1280x720
chunklist_w517510829.m3u8

And I get the following error when trying to play it:

Uncaught NotSupportedError: Failed to execute 'addSourceBuffer' on 'MediaSource': The type provided ('video/mp2t; codecs="avc1.66.31,mp4a.40.2"') is unsupported.
player.js:1682 Uncaught TypeError: undefined is not a function

Strangely enough it plays fine on the Chromecast if I remove avc1.66.31,mp4a.40.2. I am using this sample as a player https://github.com/googlecast/Cast-Player-Sample

Thanks.

2 Answers 2

2

Some builds of Chromecast reject "avc1.66.31" so it is recommendation to use "avc1.66.30" instead either by updating the playlist or using host.processManifest workaround

host.processManifest = function(manifest) {
  return manifest.replace(/CODECS=\"avc1.66.([0-9]*)/g, 'CODECS=\"avc1.66.30');
};

in a custom receiver.

2
  • Would I do this on the player.js file?
    – casolorz
    Commented Jul 8, 2015 at 1:02
  • Yes, if you search for "host" in that file, you'll find it.
    – Ali Naddaf
    Commented Jul 8, 2015 at 5:13
1

In the new versions of Chromecast, I had to:

context.getPlayerManager().setMediaPlaybackInfoHandler((loadRequest, playbackConfig) => {

  if (loadRequest.media.customData &&
      loadRequest.media.customData.playbackConfig && 
      loadRequest.media.customData.playbackConfig.manifestHandler) {

     playbackConfig.manifestHandler = loadRequest.media.customData.playbackConfig.manifestHandler;
  }

  return playbackConfig;
});

And then I load the media information this way (removing avc1.100 format lines from the manifest):

const mediaInformation = new window.cast.framework.messages.MediaInformation();

...

mediaInformation.hlsSegmentFormat = window.cast.framework.messages.HlsSegmentFormat.TS;

mediaInformation.customData = {

  manifestHandler: manifest => {

      const lines = manifest.split(/\n/);
      const result = [];

      let i = 0;
      while(i < lines.length) {
      if (lines[i].match(/avc1\.100\./)) {
        i += 2;
      } else {
        result.push(lines[i]);
        i++;
      }
     }

     return result.join('\n');
  }
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.