From e74acf04f793a719a7f83db53b483fb047eaea0b Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 9 Nov 2020 16:23:13 +0100 Subject: [PATCH] Update connection indicator --- web/static/js/ovenplayer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/static/js/ovenplayer.js b/web/static/js/ovenplayer.js index 3a53d4d..47d6b0e 100644 --- a/web/static/js/ovenplayer.js +++ b/web/static/js/ovenplayer.js @@ -52,7 +52,16 @@ export function initViewerPage(stream, viewersCounterRefreshPeriod, posterUrl) { } ] }); + player.on("stateChanged", function (prevstate, newstate) { + if (newstate === "loading") { + document.getElementById("connectionIndicator").style.fill = '#ffc107' + } + if (newstate === "ready" || newstate === "play") { + document.getElementById("connectionIndicator").style.fill = '#28a745' + } + }) player.on("error", function (error) { + document.getElementById("connectionIndicator").style.fill = '#dc3545' if (error.code === 501 || error.code === 406) { // Clear messages const errorMsg = document.getElementsByClassName("op-message-text")[0]