Skip to content

Commit b64351b

Browse files
Fix streams not restarting because player='' auto and we need to be looking at activePlayer
1 parent 6185c53 commit b64351b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

web/js/MonitorStream.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,15 @@ function MonitorStream(monitorData) {
506506
}
507507
if (-1 == src.search('connkey')) {
508508
src += '&connkey='+this.connKey;
509+
509510
}
511+
stream.onerror = this.img_onerror.bind(this);
512+
stream.onload = this.img_onload.bind(this);
513+
510514
if (stream.src != src) {
511-
console.log("Setting to streaming: " + src);
512515
stream.src = '';
513516
stream.src = src;
514517
}
515-
stream.onerror = this.img_onerror.bind(this);
516-
stream.onload = this.img_onload.bind(this);
517518
this.started = true;
518519
this.streamListenerBind();
519520
this.activePlayer = 'zms';
@@ -547,7 +548,9 @@ function MonitorStream(monitorData) {
547548
stream.src = src;
548549
}
549550
}
550-
this.streamCommand(CMD_STOP);
551+
if (stream.src) {
552+
this.streamCommand(CMD_STOP);
553+
}
551554
} else if (-1 !== this.activePlayer.indexOf('go2rtc')) {
552555
if (!(stream.wsState === WebSocket.CLOSED && stream.pcState === WebSocket.CLOSED)) {
553556
try {
@@ -656,7 +659,7 @@ function MonitorStream(monitorData) {
656659
stream.onload = null;
657660

658661
// this.stop tells zms to stop streaming, but the process remains. We need to turn the stream into an image.
659-
if (stream.src && (-1 !== this.player.indexOf('zms'))) {
662+
if (stream.src && (-1 !== this.activePlayer.indexOf('zms'))) {
660663
stream.src = '';
661664
// Make zms exit
662665
this.streamCommand(CMD_QUIT);

0 commit comments

Comments
 (0)