Constrain screensharing in getDisplayMedia

master
Håvar Aambø Fosstveit 2020-03-18 10:07:15 +01:00
parent 023aac3c21
commit fd58940916
2 changed files with 18 additions and 5 deletions

View File

@ -2484,9 +2484,9 @@ export default class RoomClient
logger.debug('enableScreenSharing() | calling getUserMedia()'); logger.debug('enableScreenSharing() | calling getUserMedia()');
const stream = await this._screenSharing.start({ const stream = await this._screenSharing.start({
width : 1280, width : 1920,
height : 720, height : 1080,
frameRate : 3 frameRate : 5
}); });
track = stream.getVideoTracks()[0]; track = stream.getVideoTracks()[0];

View File

@ -101,12 +101,25 @@ class DisplayMediaScreenShare
return true; return true;
} }
_toConstraints() _toConstraints(options)
{ {
const constraints = { const constraints = {
video : true video : {}
}; };
if (isFinite(options.width))
{
constraints.video.width = options.width;
}
if (isFinite(options.height))
{
constraints.video.height = options.height;
}
if (isFinite(options.frameRate))
{
constraints.video.frameRate = options.frameRate;
}
return constraints; return constraints;
} }
} }