Updated resolution handling.

master
Håvar Aambø Fosstveit 2018-06-17 23:14:42 +02:00
parent bca6db0e5e
commit 7857ae27dd
1 changed files with 93 additions and 60 deletions

View File

@ -48,6 +48,9 @@ export default class RoomClient
// Redux store getState function. // Redux store getState function.
this._getState = getState; this._getState = getState;
// This device
this._device = device;
// My peer name. // My peer name.
this._peerName = peerName; this._peerName = peerName;
@ -459,27 +462,37 @@ export default class RoomClient
logger.debug('changeWebcam() | calling getUserMedia()'); logger.debug('changeWebcam() | calling getUserMedia()');
return navigator.mediaDevices.getUserMedia( if (this._device.flag !== 'chrome')
{ return navigator.mediaDevices.getUserMedia(
video :
{ {
deviceId : { exact: device.deviceId }, video :
optional : [ {
{ minWidth: 160 }, deviceId : { exact: device.deviceId },
{ minWidth: 176 }, width : { ideal: 3840 }
{ minWidth: 320 }, }
{ minWidth: 352 }, });
{ minWidth: 640 }, else
{ minWidth: 800 }, return navigator.mediaDevices.getUserMedia(
{ minWidth: 1024 }, {
{ minWidth: 1280 }, video :
{ minWidth: 1600 }, {
{ minWidth: 1920 }, deviceId : { exact: device.deviceId },
{ minWidth: 2560 }, optional : [
{ minWidth: 3840 } { minWidth: 160 },
] { minWidth: 176 },
} { minWidth: 320 },
}); { minWidth: 352 },
{ minWidth: 640 },
{ minWidth: 800 },
{ minWidth: 1024 },
{ minWidth: 1280 },
{ minWidth: 1600 },
{ minWidth: 1920 },
{ minWidth: 2560 },
{ minWidth: 3840 }
]
}
});
}) })
.then((stream) => .then((stream) =>
{ {
@ -550,27 +563,37 @@ export default class RoomClient
logger.debug('changeWebcamResolution() | calling getUserMedia()'); logger.debug('changeWebcamResolution() | calling getUserMedia()');
return navigator.mediaDevices.getUserMedia( if (this._device.flag !== 'chrome')
{ return navigator.mediaDevices.getUserMedia(
video :
{ {
deviceId : { exact: device.deviceId }, video :
optional : [ {
{ minWidth: 160 }, deviceId : { exact: device.deviceId },
{ minWidth: 176 }, width : { ideal: 3840 }
{ minWidth: 320 }, }
{ minWidth: 352 }, });
{ minWidth: 640 }, else
{ minWidth: 800 }, return navigator.mediaDevices.getUserMedia(
{ minWidth: 1024 }, {
{ minWidth: 1280 }, video :
{ minWidth: 1600 }, {
{ minWidth: 1920 }, deviceId : { exact: device.deviceId },
{ minWidth: 2560 }, optional : [
{ minWidth: 3840 } { minWidth: 160 },
] { minWidth: 176 },
} { minWidth: 320 },
}); { minWidth: 352 },
{ minWidth: 640 },
{ minWidth: 800 },
{ minWidth: 1024 },
{ minWidth: 1280 },
{ minWidth: 1600 },
{ minWidth: 1920 },
{ minWidth: 2560 },
{ minWidth: 3840 }
]
}
});
}) })
.then((stream) => .then((stream) =>
{ {
@ -1473,27 +1496,37 @@ export default class RoomClient
logger.debug('_setWebcamProducer() | calling getUserMedia()'); logger.debug('_setWebcamProducer() | calling getUserMedia()');
return navigator.mediaDevices.getUserMedia( if (this._device.flag !== 'chrome')
{ return navigator.mediaDevices.getUserMedia(
video :
{ {
deviceId : { exact: device.deviceId }, video :
optional : [ {
{ minWidth: 160 }, deviceId : { exact: device.deviceId },
{ minWidth: 176 }, width : { ideal: 3840 }
{ minWidth: 320 }, }
{ minWidth: 352 }, });
{ minWidth: 640 }, else
{ minWidth: 800 }, return navigator.mediaDevices.getUserMedia(
{ minWidth: 1024 }, {
{ minWidth: 1280 }, video :
{ minWidth: 1600 }, {
{ minWidth: 1920 }, deviceId : { exact: device.deviceId },
{ minWidth: 2560 }, optional : [
{ minWidth: 3840 } { minWidth: 160 },
] { minWidth: 176 },
} { minWidth: 320 },
}); { minWidth: 352 },
{ minWidth: 640 },
{ minWidth: 800 },
{ minWidth: 1024 },
{ minWidth: 1280 },
{ minWidth: 1600 },
{ minWidth: 1920 },
{ minWidth: 2560 },
{ minWidth: 3840 }
]
}
});
}) })
.then((stream) => .then((stream) =>
{ {