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