From 384eac3807fe93a845c49a2514b15e1fee1d9ee5 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 26 Mar 2014 11:33:18 +0100 Subject: [PATCH] Fixes crash on Android when resolution is undefined in get user media. --- libs/strophe/strophe.jingle.adapter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.js index ae5b3d013..56d9d9ec3 100644 --- a/libs/strophe/strophe.jingle.adapter.js +++ b/libs/strophe/strophe.jingle.adapter.js @@ -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 } // 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; break; default: - if (navigator.userAgent.indexOf('Android') != -1) { + if (isAndroid) { constraints.video.mandatory.minWidth = 320; constraints.video.mandatory.minHeight = 240; constraints.video.mandatory.maxFrameRate = 15;