mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-13 04:12:53 +02:00
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:
commit
d0a3aeb7cf
1 changed files with 17 additions and 3 deletions
|
@ -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){
|
||||
|
|
Loading…
Reference in a new issue