From 34703fbb86fd64fe8ce166e2f4fb3cf0c702df29 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Nov 2021 14:59:29 -0700 Subject: [PATCH] hah --- ogv.html | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ogv.html b/ogv.html index 0a9c6df..c7aaf51 100644 --- a/ogv.html +++ b/ogv.html @@ -134,7 +134,7 @@ return (typeof MediaSource == 'function') && MediaSource.isTypeSupported(mime); } 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 mp3 = can('audio/mp3'); //var mp3 = can('audio/mp4; codecs="mp4a.40.34"'); @@ -155,10 +155,15 @@ } var webm = null; + var m3u8 = null; for (let source of hls1.querySelectorAll('source')) { if (source.type.startsWith('video/webm')) { webm = source; - break; + continue; + } + if (source.type == 'application/vnd.apple.mpegurl') { + m3u8 = source; + continue; } } @@ -185,25 +190,33 @@ hls1.classList.add('vjs-default-skin'); var vjs1 = videojs(hls1, playerConfig); - /* vjs1.on('error', function failover() { console.log('got error'); var error = vjs1.error(); 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 - if (webm) { - console.log('going to ' + webm.getAttribute('src')); + console.log(m3u8); + 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([{ src: webm.getAttribute('src'), type: webm.getAttribute('type') }]); vjs1.reset(); + webm = null; } } vjs1.off('error', failover); }); - */ // this fails on Chrome with a blob issue on the HLS player :D //vjs1.load();