diff --git a/server/src/main/resources/html/static/index.html b/server/src/main/resources/html/static/index.html index 26c5628c..25f2ab36 100644 --- a/server/src/main/resources/html/static/index.html +++ b/server/src/main/resources/html/static/index.html @@ -244,7 +244,7 @@ name: '', url: modelUrl }; - console.log(model); + if(console) console.log(model); let action = '{"action": "startByUrl", "model": ' + JSON.stringify(model) + '}'; $.ajax({ type : 'POST', @@ -264,11 +264,11 @@ } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Adding model failed', 'error'); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } }, @@ -292,11 +292,11 @@ } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Resuming recording of model ' + model.name + ' failed', 'error'); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } }, @@ -320,11 +320,11 @@ } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Suspending recording of model ' + model.name + ' failed', 'error'); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } }, @@ -349,11 +349,11 @@ } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Removing model ' + model.name + ' failed', 'error'); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } }, @@ -379,19 +379,20 @@ } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Removing recording ' + name + ' failed', 'error'); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } } }; function play(recording) { let src = recording.playlist; - src = '..' + src; let hmacOfPath = CryptoJS.HmacSHA256(src, hmac); + src = '..' + src; + if(console) console.log("Path", src, "HMAC", hmacOfPath); if (hmac.length > 0) { src += "?hmac=" + hmacOfPath; } @@ -407,20 +408,19 @@ $('#player-window').css('display', 'block'); video.play(); } - video.onloadedmetadata = function() { - console.log(video); - } } else { if (Hls.isSupported()) { var video = document.getElementById('player'); var hls = new Hls(); hls.attachMedia(video); hls.on(Hls.Events.MEDIA_ATTACHED, function () { - console.log(src); + if(console) console.log(src); hls.loadSource(src); hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) { - console.log(data); - console.log("manifest loaded, found " + data.levels.length + " quality level"); + if(console) { + console.log(data); + console.log("manifest loaded, found " + data.levels.length + " quality level"); + } $('#player-window').css('display', 'block'); video.play(); }); @@ -428,7 +428,7 @@ }); } else { $.notify('Loading HLS video streaming support failed', 'error'); - console.log('HLS is not supported'); + if(console) console.log('HLS is not supported'); } } } @@ -451,10 +451,10 @@ $(document).ready(function() { if (localStorage !== undefined && localStorage.hmac !== undefined) { - console.log('using hmac from local storage'); + if(console) console.log('using hmac from local storage'); hmac = localStorage.hmac; } else { - console.log('hmac not found in local storage. requesting hmac from server'); + if(console) console.log('hmac not found in local storage. requesting hmac from server'); $.ajax({ type : 'GET', url : '../secured/hmac', @@ -465,12 +465,12 @@ .done(function(data) { hmac = data.hmac; if (localStorage !== undefined) { - console.log('saving hmac to local storage'); + if(console) console.log('saving hmac to local storage'); localStorage.setItem("hmac", hmac); } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); $.notify('Couldn\'t get HMAC', 'error'); hmac = ''; }); @@ -508,15 +508,15 @@ if (data.status === 'success') { onlineModels = data.models; } else { - console.log('request failed', data); + if(console) console.log('request failed', data); } updateModels(); }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(jqXHR, textStatus, errorThrown); + if(console) console.log(jqXHR, textStatus, errorThrown); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } setTimeout(updateOnlineModels, 3000); } @@ -619,14 +619,14 @@ if (data.status === 'success') { syncModels(data.models); } else { - console.log('request failed', data); + if(console) console.log('request failed', data); } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } } @@ -716,14 +716,14 @@ syncRecordings(data.recordings); updateDiskSpace(); } else { - console.log('request failed', data); + if(console) console.log('request failed', data); } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); }); } catch (e) { - console.log('Unexpected error', e); + if(console) console.log('Unexpected error', e); } setTimeout(updateRecordings, 3000); } @@ -746,11 +746,11 @@ space.percent( (data.spaceFree/data.spaceTotal*100).toFixed(2) ); space.text(calculateSize(data.spaceFree) + ' / ' + calculateSize(data.spaceTotal)); } else { - console.log('request failed', data); + if(console) console.log('request failed', data); } }) .fail(function(jqXHR, textStatus, errorThrown) { - console.log(textStatus, errorThrown); + if(console) console.log(textStatus, errorThrown); }); }