Merge pull request #16549 from zfox23/autoMinimizeScreenshare

DEV-2832, DEV-2816, DEV-2843: Auto-minimize Screen Share; enable switching between windows; prevent video dropout
This commit is contained in:
Zach Fox 2019-11-27 14:02:34 -05:00 committed by GitHub
commit d0a3aeb7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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){