Skip to content

Commit b91387c

Browse files
committed
Extended the getUserMedia and window.URL check.
1 parent aabeccb commit b91387c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/system/Device.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Phaser.Device = function () {
207207
* @property {boolean} getUserMedia - Does the device support the getUserMedia API?
208208
* @default
209209
*/
210-
this.getUserMedia = false;
210+
this.getUserMedia = true;
211211

212212
/**
213213
* @property {boolean} quirksMode - Is the browser running in strict mode (false) or quirks mode? (true)
@@ -699,7 +699,20 @@ Phaser.Device._initialize = function () {
699699

700700
device.quirksMode = (document.compatMode === 'CSS1Compat') ? false : true;
701701

702-
device.getUserMedia = !!(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
702+
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
703+
704+
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
705+
706+
device.getUserMedia = device.getUserMedia && !!navigator.getUserMedia && !!window.URL;
707+
708+
// Older versions of firefox (< 21) apparently claim support but user media does not actually work
709+
if (navigator.userAgent.match(/Firefox\D+(\d+)/))
710+
{
711+
if (parseInt(RegExp.$1, 10) < 21)
712+
{
713+
device.getUserMedia = false;
714+
}
715+
}
703716

704717
// TODO: replace canvasBitBltShift detection with actual feature check
705718

0 commit comments

Comments
 (0)