@@ -13,7 +13,7 @@ function MonitorStream(monitorData) {
1313 this . width = monitorData . width ;
1414 this . height = monitorData . height ;
1515 this . RTSP2WebEnabled = monitorData . RTSP2WebEnabled ;
16- this . RTSP2WebType = monitorData . RTSP2WebType ;
16+ this . RTSP2WebType = null ;
1717 this . RTSP2WebStream = monitorData . RTSP2WebStream ;
1818 this . Go2RTCEnabled = monitorData . Go2RTCEnabled ;
1919 this . Go2RTCMSEBufferCleared = true ;
@@ -83,7 +83,7 @@ function MonitorStream(monitorData) {
8383 }
8484 } ;
8585
86- this . player = '' ;
86+ this . player = monitorData . DefaultPlayer ;
8787 this . activePlayer = '' ; // Variants: go2rtc, janus, rtsp2web_hls, rtsp2web_mse, rtsp2web_webrtc, zms. Relevant for this.player = ''/Auto
8888 this . setPlayer = function ( p ) {
8989 if ( - 1 != p . indexOf ( 'go2rtc' ) ) {
@@ -438,7 +438,7 @@ function MonitorStream(monitorData) {
438438 rtsp2webModUrl . password = '' ;
439439 //.urlParts.length > 1 ? urlParts[1] : urlParts[0]; // drop the username and password for viewing
440440 this . currentChannelStream = ( streamChannel == 'default' ) ? ( ( this . RTSP2WebStream == 'Secondary' ) ? 1 : 0 ) : streamChannel ;
441- if ( this . RTSP2WebType == 'HLS' ) {
441+ if ( - 1 ! == this . player . indexOf ( 'hls' ) ) {
442442 const hlsUrl = rtsp2webModUrl ;
443443 hlsUrl . pathname = "/stream/" + this . id + "/channel/" + this . currentChannelStream + "/hls/live/index.m3u8" ;
444444 /*
@@ -456,14 +456,14 @@ function MonitorStream(monitorData) {
456456 stream . src = hlsUrl . href ;
457457 }
458458 this . activePlayer = 'rtsp2web_hls' ;
459- } else if ( this . RTSP2WebType == 'MSE' ) {
459+ } else if ( - 1 ! == this . player . indexOf ( 'mse' ) ) {
460460 const mseUrl = rtsp2webModUrl ;
461461 mseUrl . protocol = useSSL ? 'wss' : 'ws' ;
462462 mseUrl . pathname = "/stream/" + this . id + "/channel/" + this . currentChannelStream + "/mse" ;
463463 mseUrl . search = "uuid=" + this . id + "&channel=" + this . currentChannelStream + "" ;
464464 startMsePlay ( this , stream , mseUrl . href ) ;
465465 this . activePlayer = 'rtsp2web_mse' ;
466- } else if ( this . RTSP2WebType == 'WebRTC' ) {
466+ } else if ( - 1 ! == this . player . indexOf ( 'webrtc' ) ) {
467467 const webrtcUrl = rtsp2webModUrl ;
468468 webrtcUrl . pathname = "/stream/" + this . id + "/channel/" + this . currentChannelStream + "/webrtc" ;
469469 startRTSP2WebPlay ( stream , webrtcUrl . href , this ) ;
@@ -473,7 +473,7 @@ function MonitorStream(monitorData) {
473473 this . statusCmdTimer = setInterval ( this . statusCmdQuery . bind ( this ) , statusRefreshTimeout ) ;
474474 this . started = true ;
475475 this . streamListenerBind ( ) ;
476- this . updateStreamInfo ( 'RTSP2Web ' + this . RTSP2WebType ) ;
476+ this . updateStreamInfo ( players ? players [ this . player ] : 'RTSP2Web ' + this . RTSP2WebType ) ;
477477 return ;
478478 } else {
479479 console . log ( "ZM_RTSP2WEB_PATH is empty. Go to Options->System and set ZM_RTSP2WEB_PATH accordingly." ) ;
@@ -574,7 +574,7 @@ function MonitorStream(monitorData) {
574574 this . hls . destroy ( ) ;
575575 this . hls = null ;
576576 }
577- if ( this . RTSP2WebType == 'MSE' ) {
577+ if ( - 1 ! == this . activePlayer . indexOf ( 'mse' ) ) {
578578 this . stopMse ( ) ;
579579 }
580580 } else if ( - 1 !== this . activePlayer . indexOf ( 'janus' ) ) {
@@ -1259,7 +1259,7 @@ function MonitorStream(monitorData) {
12591259 if ( this . Go2RTCEnabled && ( ( ! this . player ) || ( - 1 !== this . player . indexOf ( 'go2rtc' ) ) ) ) {
12601260 } else if ( this . RTSP2WebEnabled && ( ( ! this . player ) || ( - 1 !== this . player . indexOf ( 'rtsp2web' ) ) ) ) {
12611261 // We correct the lag from real time. Relevant for long viewing and network problems.
1262- if ( this . RTSP2WebType == 'MSE' ) {
1262+ if ( - 1 ! == this . activePlayer . indexOf ( 'mse' ) ) {
12631263 const videoEl = document . getElementById ( "liveStream" + this . id ) ;
12641264 if ( this . wsMSE && videoEl . buffered != undefined && videoEl . buffered . length > 0 ) {
12651265 const videoElCurrentTime = videoEl . currentTime ; // Current time of playback
@@ -1295,7 +1295,7 @@ function MonitorStream(monitorData) {
12951295 console . warn ( `UNSCHEDULED CLOSE SOCKET for camera ID=${ this . id } ` ) ;
12961296 this . restart ( this . currentChannelStream ) ;
12971297 }
1298- } else if ( this . RTSP2WebType == 'WebRTC' ) {
1298+ } else if ( - 1 ! == this . player . indexOf ( 'webrtc' ) ) {
12991299 if ( ( ! this . webrtc || ( this . webrtc && this . webrtc . connectionState != "connected" ) ) && this . started ) {
13001300 console . warn ( `UNSCHEDULED CLOSE WebRTC for camera ID=${ this . id } ` ) ;
13011301 this . restart ( this . currentChannelStream ) ;
0 commit comments