diff --git a/screenshare/src/screenshareApp.js b/screenshare/src/screenshareApp.js index 2abc151988..b16f5ca993 100644 --- a/screenshare/src/screenshareApp.js +++ b/screenshare/src/screenshareApp.js @@ -7,6 +7,8 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +const { remote } = require('electron'); + // Helpers function handleError(error) { if (error) { @@ -188,6 +190,10 @@ function stopSharing() { // Callback to start publishing after we have setup the chromium stream function gotStream(stream) { + if (localStream) { + stopSharing(); + } + localStream = stream; startTokboxPublisher(localStream); @@ -206,6 +212,9 @@ function onAccessApproved(desktop_id) { console.log('Desktop Capture access rejected.'); return; } + + + document.getElementById('screenshare').style.visibility = "block"; desktopSharing = true; navigator.webkitGetUserMedia({ @@ -221,6 +230,7 @@ function onAccessApproved(desktop_id) { } } }, gotStream, handleError); + remote.getCurrentWindow().minimize(); } @@ -248,11 +258,15 @@ var publisher; function startTokboxPublisher(stream) { publisher = document.createElement("div"); var publisherOptions = { - videoSource: stream.getVideoTracks()[0], + audioFallbackEnabled: false, audioSource: null, + fitMode: 'contain', + frameRate: 30, + height: 720, insertMode: 'append', - width: 1280, - height: 720 + publishAudio: false, + videoSource: stream.getVideoTracks()[0], + width: 1280 }; publisher = OT.initPublisher(publisher, publisherOptions, function(error){