From 4c16557192cd40712387c4832c37b361d7504443 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 11 Jan 2022 10:45:40 -0500 Subject: [PATCH] When error with ajax, delay fetchImage and add logging --- web/skins/classic/views/js/watch.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 89f774ed1..3a48581a0 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -361,7 +361,7 @@ function getStreamCmdResponse(respObj, respText) { } else { console.log("Not ok"); checkStreamForErrors('getStreamCmdResponse', respObj);//log them - fetchImage($j('#imageFeed img')); + setTimeout(fetchImage, 1000, $j('#imageFeed img')); } var streamCmdTimeout = statusRefreshTimeout; @@ -706,8 +706,10 @@ function controlCmdImage(x, y) { function fetchImage(streamImage) { const oldsrc = streamImage.attr('src'); +const newsrc = oldsrc.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) )); +console.log("New src: " + newsrc); streamImage.attr('src', ''); - streamImage.attr('src', oldsrc.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ))); + streamImage.attr('src', newsrc); } function handleClick(event) {