From ed3334ca6cccd6227e4da0eb2989c9635906d949 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Feb 2021 20:57:01 -0500 Subject: [PATCH] add hls initialization error checking --- op25/gr-op25_repeater/www/www-static/live.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/op25/gr-op25_repeater/www/www-static/live.html b/op25/gr-op25_repeater/www/www-static/live.html index 9297cd2..60afd48 100644 --- a/op25/gr-op25_repeater/www/www-static/live.html +++ b/op25/gr-op25_repeater/www/www-static/live.html @@ -12,12 +12,17 @@ function onload1() { } function attach_hls() { var video = document.getElementById('video'); + document.getElementById('div1').innerHTML = 'Initialization state 1
'; if (Hls.isSupported()) { + document.getElementById('div1').innerHTML = 'Initialization state 1a
'; hls = new Hls(); hls.loadSource(videoSrc); hls.attachMedia(video); + document.getElementById('div1').innerHTML = 'Initialization state 1b
'; hls.on(Hls.Events.MANIFEST_PARSED, function() { + document.getElementById('div1').innerHTML = 'Initialization state 1c
'; video.play(); + document.getElementById('div1').innerHTML = 'Initialization state 1d: load completed OK
'; }); } // hls.js is not supported on platforms that do not have Media Source @@ -34,10 +39,15 @@ function attach_hls() { // event will be emitted; the last video event that can be reliably // listened-for when the URL is not on the white-list is 'loadedmetadata'. else if (video.canPlayType('application/vnd.apple.mpegurl')) { + document.getElementById('div1').innerHTML = 'Initialization state 2
'; video.src = videoSrc; video.addEventListener('loadedmetadata', function() { + document.getElementById('div1').innerHTML = 'Initialization state 2a
'; video.play(); + document.getElementById('div1').innerHTML = 'Initialization state 2b: load completed OK
'; }); + } else { + document.getElementById('div1').innerHTML = 'Unable to initialize HLS: failed to detect and enable media source or mp4 support
'; } } // end of attach_hls() @@ -46,5 +56,6 @@ function attach_hls() {

+
Initialization state 0