When error with ajax, delay fetchImage and add logging

This commit is contained in:
Isaac Connor 2022-01-11 10:45:40 -05:00
parent 6219989884
commit 4c16557192
1 changed files with 4 additions and 2 deletions

View File

@ -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) {