Skip to content

Commit

Permalink
[mirotalk] - set webcam max resolution as default
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jun 22, 2022
1 parent 459f10c commit f154b40
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions public/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ const showFileShareBtn = true;
const showMySettingsBtn = true;
const showAboutBtn = true;

// force the webCam to max resolution, up to 4k as default
const forceCamMaxResolution = true;

/**
* Load all Html elements by Id
*/
Expand Down Expand Up @@ -1255,8 +1258,7 @@ function setupLocalMedia(callback, errorback) {
console.log('Supported constraints', navigator.mediaDevices.getSupportedConstraints());

// default | qvgaVideo | vgaVideo | hdVideo | fhdVideo | 2kVideo | 4kVideo |
let videoConstraints =
myBrowserName === 'Firefox' ? getVideoConstraints('useVideo') : getVideoConstraints('default');
let videoConstraints = getVideoConstraints('default');

const constraints = {
audio: {
Expand Down Expand Up @@ -2614,12 +2616,16 @@ function getVideoConstraints(videoQuality) {
let frameRate = { max: videoMaxFrameRate };

switch (videoQuality) {
case 'useVideo':
return useVideo;
// Firefox not support set frameRate (OverconstrainedError) O.o
case 'default':
if (forceCamMaxResolution) {
// This will make the browser use the maximum resolution available as default, `up to 4K`.
return {
width: { ideal: 3840 },
height: { ideal: 2160 },
frameRate: frameRate,
}; // video cam constraints default
}
return { frameRate: frameRate };
// video cam constraints default
case 'qvgaVideo':
return {
width: { exact: 320 },
Expand Down

0 comments on commit f154b40

Please sign in to comment.