Skip to content
Snippets Groups Projects
Commit 6a94e9cd authored by Simon Döring's avatar Simon Döring
Browse files

Fix bug on receiver side

The bug occured when a listener client clicked connect before janus was initialized
parent 375a3106
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ var opaqueId = 'camera-receiver-' + Janus.randomString(12);
var room = 1000;
var source = null;
var connectClicked = false;
var urlParams = new URLSearchParams(window.location.search);
var roomParam = urlParams.get('room');
if (roomParam != null && !isNaN(roomParam)) {
......@@ -17,7 +19,14 @@ if (roomParam != null && !isNaN(roomParam)) {
}
document.addEventListener('DOMContentLoaded', function() {
Janus.init({ debug: false, callback: function() {
var connectButton = document.getElementById('noVNC_connect_button');
connectButton.onclick = function() {
connectButton.onclick = null;
connectClicked = true;
};
Janus.init({ debug: true, callback: function() {
if (!Janus.isWebrtcSupported()) {
alert('No WebRTC support... ');
return;
......@@ -33,11 +42,14 @@ document.addEventListener('DOMContentLoaded', function() {
videoroomHandle = pluginHandle;
Janus.log('Plugin attached! (' + videoroomHandle.getPlugin() + ', id=' + videoroomHandle.getId() + ')');
var connectButton = document.getElementById('noVNC_connect_button');
if (connectClicked) {
joinRoom();
} else {
connectButton.onclick = function() {
connectButton.onclick = null;
joinRoom();
};
}
},
error: function(error) {
Janus.error('Error attaching plugin: ', error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment