You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/spectrogram.php
+41-39Lines changed: 41 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -481,45 +481,47 @@ function loop(time) {
481
481
482
482
<script>
483
483
var rtsp_stream_select = document.getElementById("rtsp_stream_select");
484
-
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RTSP stream
485
-
rtsp_stream_select.onchange = function() {
486
-
if (this.value !== 'undefined'){
487
-
// Get the audio player element
488
-
var audio_player = document.querySelector('audio#player');
489
-
var central_controls_element = document.getElementsByClassName('centered')[0];
490
-
491
-
//Create the loading header again as a placeholder while we're waiting to reload the stream
492
-
var h1_loading = document.createElement("H1");
493
-
var h1_loading_text = document.createTextNode("Loading...");
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
508
-
// Restart the audio player in case it stopped working while the livestream service was restarted
509
-
if(audio_player !== 'undefined'){
510
-
central_controls_element.appendChild(h1_loading);
511
-
//Wait 5 seconds before restarting the stream
512
-
setTimeout(function () {
513
-
audio_player.pause();
514
-
audio_player.setAttribute('src', '/stream');
515
-
audio_player.load();
516
-
audio_player.play();
517
-
518
-
document.getElementById('loading-h1').remove()
519
-
},
520
-
10000
521
-
)
522
-
}
484
+
if (typeof (rtsp_stream_select) !== 'undefined' && rtsp_stream_select !== null) {
485
+
//When the dropdown selection is changed set the new value is settings, then restart the livestream service so it broadcasts newly selected RTSP stream
486
+
rtsp_stream_select.onchange = function () {
487
+
if (this.value !== 'undefined') {
488
+
// Get the audio player element
489
+
var audio_player = document.querySelector('audio#player');
490
+
var central_controls_element = document.getElementsByClassName('centered')[0];
491
+
492
+
//Create the loading header again as a placeholder while we're waiting to reload the stream
493
+
var h1_loading = document.createElement("H1");
494
+
var h1_loading_text = document.createTextNode("Loading...");
0 commit comments