This commit is contained in:
Brooke Vibber 2021-11-03 14:59:29 -07:00
parent f7dae630aa
commit 34703fbb86

View file

@ -134,7 +134,7 @@
return (typeof MediaSource == 'function') && MediaSource.isTypeSupported(mime); return (typeof MediaSource == 'function') && MediaSource.isTypeSupported(mime);
} }
var vp9 = can('video/mp4; codecs="vp09.00.10.08"'); var vp9 = can('video/mp4; codecs="vp09.00.10.08"');
var opus = can('audio/webm; codecs="opus"'); var opus = can('audio/mp4; codecs="opus"');
var aac = can('audio/mp4; codecs="mp4a.40.02'); var aac = can('audio/mp4; codecs="mp4a.40.02');
var mp3 = can('audio/mp3'); var mp3 = can('audio/mp3');
//var mp3 = can('audio/mp4; codecs="mp4a.40.34"'); //var mp3 = can('audio/mp4; codecs="mp4a.40.34"');
@ -155,10 +155,15 @@
} }
var webm = null; var webm = null;
var m3u8 = null;
for (let source of hls1.querySelectorAll('source')) { for (let source of hls1.querySelectorAll('source')) {
if (source.type.startsWith('video/webm')) { if (source.type.startsWith('video/webm')) {
webm = source; webm = source;
break; continue;
}
if (source.type == 'application/vnd.apple.mpegurl') {
m3u8 = source;
continue;
} }
} }
@ -185,25 +190,33 @@
hls1.classList.add('vjs-default-skin'); hls1.classList.add('vjs-default-skin');
var vjs1 = videojs(hls1, playerConfig); var vjs1 = videojs(hls1, playerConfig);
/*
vjs1.on('error', function failover() { vjs1.on('error', function failover() {
console.log('got error'); console.log('got error');
var error = vjs1.error(); var error = vjs1.error();
if (error && error.code == MediaError.MEDIA_ERR_DECODE) { if (error && error.code == MediaError.MEDIA_ERR_DECODE) {
console.log('saw its decode'); console.log('saw its a decode error');
// HLS reports this if it can't find a codec it likes // HLS reports this if it can't find a codec it likes
if (webm) { console.log(m3u8);
console.log('going to ' + webm.getAttribute('src')); if (mse && m3u8) {
console.log('going to m3u8: ' + m3u8.getAttribute('src'));
vjs1.src([{
src: m3u8.getAttribute('src'),
type: m3u8.getAttribute('type')
}]);
vjs1.reset();
m3u8 = null;
} else if (webm) {
console.log('going to webm: ' + webm.getAttribute('src'));
vjs1.src([{ vjs1.src([{
src: webm.getAttribute('src'), src: webm.getAttribute('src'),
type: webm.getAttribute('type') type: webm.getAttribute('type')
}]); }]);
vjs1.reset(); vjs1.reset();
webm = null;
} }
} }
vjs1.off('error', failover); vjs1.off('error', failover);
}); });
*/
// this fails on Chrome with a blob issue on the HLS player :D // this fails on Chrome with a blob issue on the HLS player :D
//vjs1.load(); //vjs1.load();