Fixes crash on Android when resolution is undefined in get user media.
This commit is contained in:
parent
a0807f7bad
commit
384eac3807
|
@ -537,7 +537,10 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolution && !constraints.video) {
|
// Check if we are running on Android device
|
||||||
|
var isAndroid = navigator.userAgent.indexOf('Android') != -1;
|
||||||
|
|
||||||
|
if (resolution && !constraints.video || isAndroid) {
|
||||||
constraints.video = {mandatory: {}};// same behaviour as true
|
constraints.video = {mandatory: {}};// same behaviour as true
|
||||||
}
|
}
|
||||||
// see https://code.google.com/p/chromium/issues/detail?id=143631#c9 for list of supported resolutions
|
// see https://code.google.com/p/chromium/issues/detail?id=143631#c9 for list of supported resolutions
|
||||||
|
@ -580,7 +583,7 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
|
||||||
constraints.video.mandatory.minHeight = 240;
|
constraints.video.mandatory.minHeight = 240;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (navigator.userAgent.indexOf('Android') != -1) {
|
if (isAndroid) {
|
||||||
constraints.video.mandatory.minWidth = 320;
|
constraints.video.mandatory.minWidth = 320;
|
||||||
constraints.video.mandatory.minHeight = 240;
|
constraints.video.mandatory.minHeight = 240;
|
||||||
constraints.video.mandatory.maxFrameRate = 15;
|
constraints.video.mandatory.maxFrameRate = 15;
|
||||||
|
|
Loading…
Reference in New Issue