fix eslint

This commit is contained in:
Isaac Connor 2022-01-14 16:43:59 -05:00
parent 1ae61afd47
commit 8d757d37a6
3 changed files with 118 additions and 116 deletions

View File

@ -62,7 +62,7 @@ function initCycle() {
opaqueId: opaqueId,
success: function(pluginHandle) {
streaming2 = pluginHandle;
var body = { "request": "watch", "id":monitorData[monIdx].id };
var body = {"request": "watch", "id": monitorData[monIdx].id};
streaming2.send({"message": body});
},
error: function(error) {
@ -72,26 +72,27 @@ function initCycle() {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
var result = msg["result"];
if(result !== null && result !== undefined) {
if(result["status"] !== undefined && result["status"] !== null) {
var status = result["status"];
if (result !== null && result !== undefined) {
if (result["status"] !== undefined && result["status"] !== null) {
const status = result["status"];
console.log(status);
}
} else if(msg["error"] !== undefined && msg["error"] !== null) {
} else if (msg["error"] !== undefined && msg["error"] !== null) {
Janus.debug(msg["error"]);
return;
}
if(jsep !== undefined && jsep !== null) {
if (jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
// Offer from the plugin, let's answer
streaming2.createAnswer({
jsep: jsep,
// We want recvonly audio/video and, if negotiated, datachannels
media: { audioSend: false, videoSend: false, data: true },
media: {audioSend: false, videoSend: false, data: true},
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
var body = { "request": "start"};
var body = {"request": "start"};
streaming2.send({"message": body, "jsep": jsep});
},
error: function(error) {

View File

@ -307,7 +307,7 @@ function initPage() {
$j("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
}
var initJanus = false;
var streamingMonitors = [];
//var streamingMonitors = [];
for ( var i = 0, length = monitorData.length; i < length; i++ ) {
if (monitorData[i].janusEnabled) {
initJanus = true;
@ -353,57 +353,57 @@ function watchFullscreen() {
}
function attachVideo(janus, i) {
janus.attach({
plugin: "janus.plugin.streaming",
opaqueId:"streamingtest-"+Janus.randomString(12),
success: function(pluginHandle) {
janusMonitors[i].streaming = pluginHandle;
var body = { "request": "watch", "id":parseInt(janusMonitors[i].id) };
janusMonitors[i].streaming.send({"message": body});
},
error: function(error) {
Janus.error(" -- Error attaching plugin... ", error);
},
onmessage: function(msg, jsep) {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
var result = msg["result"];
if(result !== null && result !== undefined) {
if(result["status"] !== undefined && result["status"] !== null) {
var status = result["status"];
}
} else if(msg["error"] !== undefined && msg["error"] !== null) {
Janus.error(msg["error"]);
return;
}
if(jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
// Offer from the plugin, let's answer
janusMonitors[i].streaming.createAnswer({
jsep: jsep,
// We want recvonly audio/video and, if negotiated, datachannels
media: { audioSend: false, videoSend: false, data: true },
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
var body = { "request": "start"};
janusMonitors[i].streaming.send({"message": body, "jsep": jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
}
});
}
}, //onmessage function
onremotestream: function(ourstream) {
Janus.debug(" ::: Got a remote track :::");
Janus.debug(ourstream);
Janus.attachMediaStream(document.getElementById("liveStream" + janusMonitors[i].id), ourstream);
document.getElementById("liveStream" + janusMonitors[i].id).play()
janus.attach({
plugin: "janus.plugin.streaming",
opaqueId: "streamingtest-"+Janus.randomString(12),
success: function(pluginHandle) {
janusMonitors[i].streaming = pluginHandle;
var body = {"request": "watch", "id": parseInt(janusMonitors[i].id)};
janusMonitors[i].streaming.send({"message": body});
},
error: function(error) {
Janus.error(" -- Error attaching plugin... ", error);
},
onmessage: function(msg, jsep) {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
var result = msg["result"];
if (result !== null && result !== undefined) {
if (result["status"] !== undefined && result["status"] !== null) {
const status = result["status"];
console.log(status);
}
});// attach
} else if (msg["error"] !== undefined && msg["error"] !== null) {
Janus.error(msg["error"]);
return;
}
if (jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
// Offer from the plugin, let's answer
janusMonitors[i].streaming.createAnswer({
jsep: jsep,
// We want recvonly audio/video and, if negotiated, datachannels
media: {audioSend: false, videoSend: false, data: true},
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
var body = {"request": "start"};
janusMonitors[i].streaming.send({"message": body, "jsep": jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
}
});
}
}, //onmessage function
onremotestream: function(ourstream) {
Janus.debug(" ::: Got a remote track :::");
Janus.debug(ourstream);
Janus.attachMediaStream(document.getElementById("liveStream" + janusMonitors[i].id), ourstream);
document.getElementById("liveStream" + janusMonitors[i].id).play();
}
});// attach
}
// Kick everything off
$j(document).ready(initPage);

View File

@ -911,65 +911,66 @@ function initPage() {
}
}
if (streamMode == 'janus') {
server = "http://" + window.location.hostname + ":8088/janus";
opaqueId = "streamingtest-"+Janus.randomString(12);
Janus.init({debug: "all", callback: function() {
janus = new Janus({
server: server,
success: function() {
janus.attach({
plugin: "janus.plugin.streaming",
opaqueId: opaqueId,
success: function(pluginHandle) {
streaming2 = pluginHandle;
var body = { "request": "watch", "id":monitorId };
streaming2.send({"message": body});
},
error: function(error) {
Janus.error(" -- Error attaching plugin... ", error);
},
onmessage: function(msg, jsep) {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
var result = msg["result"];
if(result !== null && result !== undefined) {
if(result["status"] !== undefined && result["status"] !== null) {
var status = result["status"];
}
} else if(msg["error"] !== undefined && msg["error"] !== null) {
Janus.error(msg["error"]);
return;
}
if(jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
// Offer from the plugin, let's answer
streaming2.createAnswer({
jsep: jsep,
// We want recvonly audio/video and, if negotiated, datachannels
media: { audioSend: false, videoSend: false, data: true },
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
var body = { "request": "start"};
streaming2.send({"message": body, "jsep": jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
server = "http://" + window.location.hostname + ":8088/janus";
opaqueId = "streamingtest-"+Janus.randomString(12);
Janus.init({debug: "all", callback: function() {
janus = new Janus({
server: server,
success: function() {
janus.attach({
plugin: "janus.plugin.streaming",
opaqueId: opaqueId,
success: function(pluginHandle) {
streaming2 = pluginHandle;
var body = {"request": "watch", "id": monitorId};
streaming2.send({"message": body});
},
error: function(error) {
Janus.error(" -- Error attaching plugin... ", error);
},
onmessage: function(msg, jsep) {
Janus.debug(" ::: Got a message :::");
Janus.debug(msg);
var result = msg["result"];
if (result !== null && result !== undefined) {
if (result["status"] !== undefined && result["status"] !== null) {
var status = result["status"];
console.log(status);
}
});
} else if (msg["error"] !== undefined && msg["error"] !== null) {
Janus.error(msg["error"]);
return;
}
if (jsep !== undefined && jsep !== null) {
Janus.debug("Handling SDP as well...");
Janus.debug(jsep);
// Offer from the plugin, let's answer
streaming2.createAnswer({
jsep: jsep,
// We want recvonly audio/video and, if negotiated, datachannels
media: {audioSend: false, videoSend: false, data: true},
success: function(jsep) {
Janus.debug("Got SDP!");
Janus.debug(jsep);
var body = {"request": "start"};
streaming2.send({"message": body, "jsep": jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
}
});
}
}, //onmessage function
onremotestream: function(stream) {
Janus.debug(" ::: Got a remote track :::");
Janus.debug(stream);
Janus.attachMediaStream(document.getElementById("liveStream" + monitorId), stream);
document.getElementById("liveStream" + monitorId).play();
}
}, //onmessage function
onremotestream: function(stream) {
Janus.debug(" ::: Got a remote track :::");
Janus.debug(stream);
Janus.attachMediaStream(document.getElementById("liveStream" + monitorId), stream);
document.getElementById("liveStream" + monitorId).play();
}
});// attach
} //Success functio
}); //new Janus
}}); //janus.init callback
}); // attach
} //Success functio
}); //new Janus
}}); //janus.init callback
} else if (canStreamNative || (streamMode == 'single')) {
var streamImg = $j('#imageFeed img');
if (!streamImg) streamImg = $j('#imageFeed object');