fixed problem when circuit changed, stream couldnt be started again
This commit is contained in:
parent
bb39ac743b
commit
4e5a822ba7
|
|
@ -173,7 +173,7 @@ async function addLocalDescription(peer) {
|
|||
|
||||
function signalRemotePeer(data){
|
||||
streamws.send(data);
|
||||
console.log('[NOVNC] Signaling remote peer...');
|
||||
console.log('[NOVNC] Signaling remote peer...', data);
|
||||
}
|
||||
|
||||
function gotRemoteStream(e){
|
||||
|
|
|
|||
|
|
@ -1,10 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
document.addEventListener('oncreateroom', function(){
|
||||
let ws_scheme;
|
||||
//var ws_scheme = window.location.protocol == "https:" ? "wss://" : "ws://";
|
||||
if (server === '127.0.0.1'){
|
||||
// Local deploy
|
||||
server = '127.0.0.1:8000';
|
||||
ws_scheme = "ws://";
|
||||
}else{
|
||||
ws_scheme = "wss://";
|
||||
}
|
||||
|
||||
// Creo WS de stream
|
||||
console.log('STREAM WS: ', ws_scheme +
|
||||
//'test.unibotics.org' +
|
||||
//'127.0.0.1:8000' +
|
||||
server +
|
||||
'/ws/stream/' +
|
||||
room_name +
|
||||
'/');
|
||||
streamws = new WebSocket(
|
||||
'ws://' +
|
||||
'127.0.0.1:8000' +
|
||||
ws_scheme +
|
||||
//'test.unibotics.org'+
|
||||
//'127.0.0.1:8000' +
|
||||
server +
|
||||
'/ws/stream/' +
|
||||
room_name +
|
||||
'/'
|
||||
|
|
|
|||
17
vnc.html
17
vnc.html
|
|
@ -330,6 +330,7 @@
|
|||
let room_name;
|
||||
let users = false;
|
||||
let streamws;
|
||||
let server;
|
||||
|
||||
function createRoom(){
|
||||
room_name = Date.now()+Math.round(Math.random()*10000);
|
||||
|
|
@ -341,8 +342,12 @@
|
|||
var canvas = document.querySelector('#noVNC_container canvas');
|
||||
// Search for canvas element
|
||||
setInterval(function(){
|
||||
canvas = document.querySelector('#noVNC_container canvas');
|
||||
if(canvas === null){
|
||||
canvas = document.querySelector('#noVNC_container canvas');
|
||||
console.log('[NOVNC] ',canvas);
|
||||
stream_set = false;
|
||||
users = false;
|
||||
}else{
|
||||
if(!stream_set){
|
||||
// Send message to parent
|
||||
|
|
@ -355,12 +360,16 @@
|
|||
}
|
||||
},2000);
|
||||
|
||||
// Creo la sala
|
||||
createRoom();
|
||||
|
||||
window.addEventListener('message', function(e){
|
||||
console.log('[NOVNC] mensaje: ', e.data);
|
||||
if(e.data === 'start'){
|
||||
let data = JSON.parse(e.data);
|
||||
if(data['command'] === 'start'){
|
||||
// Set server variable
|
||||
server = data['server'];
|
||||
|
||||
// Creo la sala
|
||||
createRoom();
|
||||
|
||||
console.log('Empezar el stream');
|
||||
// Send stream_room to parent
|
||||
parent.postMessage(JSON.stringify({'stream':room_name}),'*');
|
||||
|
|
|
|||
Loading…
Reference in New Issue