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
ch
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');
}
}
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.