Fix relating auth_hash causing repeated reloads. If https, then assume a reverse proxy setup to janus. If video feed is not an img, log it and return
This commit is contained in:
parent
13ee39b1e9
commit
388735e942
|
@ -47,6 +47,11 @@ function MonitorStream(monitorData) {
|
||||||
this.scale = newscale;
|
this.scale = newscale;
|
||||||
|
|
||||||
const oldSrc = img.getAttribute('src');
|
const oldSrc = img.getAttribute('src');
|
||||||
|
if (!oldSrc) {
|
||||||
|
console.log("No src on img?!");
|
||||||
|
console.log(img);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let newSrc = '';
|
let newSrc = '';
|
||||||
|
|
||||||
img.setAttribute('src', '');
|
img.setAttribute('src', '');
|
||||||
|
@ -85,7 +90,14 @@ function MonitorStream(monitorData) {
|
||||||
|
|
||||||
if (this.janusEnabled) {
|
if (this.janusEnabled) {
|
||||||
var id = parseInt(this.id);
|
var id = parseInt(this.id);
|
||||||
var server = "http://" + window.location.hostname + ":8088/janus";
|
var server;
|
||||||
|
if (window.location.protocol=='https:') {
|
||||||
|
// Assume reverse proxy setup for now
|
||||||
|
server = "https://" + window.location.hostname + "/janus";
|
||||||
|
} else {
|
||||||
|
server = "http://" + window.location.hostname + ":8088/janus";
|
||||||
|
}
|
||||||
|
|
||||||
if (janus == null) {
|
if (janus == null) {
|
||||||
Janus.init({debug: "all", callback: function() {
|
Janus.init({debug: "all", callback: function() {
|
||||||
janus = new Janus({server: server}); //new Janus
|
janus = new Janus({server: server}); //new Janus
|
||||||
|
@ -178,11 +190,16 @@ function MonitorStream(monitorData) {
|
||||||
this.getStreamCmdResponse = function(respObj, respText) {
|
this.getStreamCmdResponse = function(respObj, respText) {
|
||||||
var stream = $j('#liveStream'+this.id)[0];
|
var stream = $j('#liveStream'+this.id)[0];
|
||||||
|
|
||||||
if ( ! stream ) {
|
if (!stream) {
|
||||||
console.log('No live stream');
|
console.log('No live stream');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//watchdogOk('stream');
|
||||||
|
if (streamCmdTimer) {
|
||||||
|
streamCmdTimer = clearTimeout(streamCmdTimer);
|
||||||
|
}
|
||||||
|
|
||||||
if ( respObj.result == 'Ok' ) {
|
if ( respObj.result == 'Ok' ) {
|
||||||
if ( respObj.status ) {
|
if ( respObj.status ) {
|
||||||
this.status = respObj.status;
|
this.status = respObj.status;
|
||||||
|
@ -202,13 +219,25 @@ function MonitorStream(monitorData) {
|
||||||
!COMPACT_MONTAGE) &&
|
!COMPACT_MONTAGE) &&
|
||||||
(this.type != 'WebSite')
|
(this.type != 'WebSite')
|
||||||
) {
|
) {
|
||||||
var fpsValue = $j('#fpsValue'+this.id);
|
const viewingFPSValue = $j('#vewingFPSValue'+this.id);
|
||||||
var stateValue = $j('#stateValue'+this.id);
|
const captureFPSValue = $j('#captureFPSValue'+this.id);
|
||||||
var monitorState = $j('#monitorState'+this.id);
|
const analysisFPSValue = $j('#analysisFPSValue'+this.id);
|
||||||
|
|
||||||
if ( fpsValue.length ) fpsValue.text(this.status.fps);
|
const stateValue = $j('#stateValue'+this.id);
|
||||||
if ( stateValue.length ) stateValue.text(stateStrings[this.alarmState]);
|
const monitorState = $j('#monitorState'+this.id);
|
||||||
if ( monitorState.length ) this.setStateClass(monitorState, stateClass);
|
|
||||||
|
if (viewingFPSValue.length && (viewingFPSValue.text != this.status.fps)) {
|
||||||
|
viewingFPSValue.text(this.status.fps);
|
||||||
|
}
|
||||||
|
if (analysisFPSValue.length && (analysisFPSValue.text != this.status.analysisfps)) {
|
||||||
|
analysisFPSValue.text(this.status.analysisfps);
|
||||||
|
}
|
||||||
|
if (captureFPSValue.length && (captureFPSValue.text != this.status.capturefps)) {
|
||||||
|
captureFPSValue.text(this.status.capturefps);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stateValue.length) stateValue.text(stateStrings[this.alarmState]);
|
||||||
|
if (monitorState.length) this.setStateClass(monitorState, stateClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setStateClass($j('#monitor'+this.id), stateClass);
|
this.setStateClass($j('#monitor'+this.id), stateClass);
|
||||||
|
@ -238,7 +267,7 @@ function MonitorStream(monitorData) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.status.auth) {
|
if (this.status.auth) {
|
||||||
if (this.status.auth != auth_hash) {
|
if (this.status.auth != this.auth_hash) {
|
||||||
// Try to reload the image stream.
|
// Try to reload the image stream.
|
||||||
if (stream) {
|
if (stream) {
|
||||||
const oldsrc = stream.src;
|
const oldsrc = stream.src;
|
||||||
|
|
Loading…
Reference in New Issue