You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/01/03 18:33:43 UTC

[2/6] guacamole-client git commit: GUACAMOLE-237: Define navigator.mediaDevices and getUserMedia when undefined.

GUACAMOLE-237: Define navigator.mediaDevices and getUserMedia when undefined.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/f6291c03
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/f6291c03
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/f6291c03

Branch: refs/heads/master
Commit: f6291c034cd3e8d672ee98afef1d7c86bba555cd
Parents: 1c27c66
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Jan 2 11:43:24 2018 -0500
Committer: Nick Couchman <vn...@apache.org>
Committed: Tue Jan 2 11:43:24 2018 -0500

----------------------------------------------------------------------
 .../src/main/webapp/modules/AudioRecorder.js        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f6291c03/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
index f925716..3a73d1d 100644
--- a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
+++ b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
@@ -187,11 +187,15 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
      *
      * @type Function
      */
-    var getUserMedia = (navigator.mediaDevices.getUserMedia
-            || navigator.getUserMedia
-            || navigator.webkitGetUserMedia
-            || navigator.mozGetUserMedia
-            || navigator.msGetUserMedia).bind(navigator);
+
+    if (navigator.mediaDevices === undefined)
+        navigator.mediaDevices = {};
+
+    if (navigator.mediaDevices.getUserMedia === undefined)
+        navigator.mediaDevices.getUserMedia = (navigator.getUserMedia
+                || navigator.webkitGetUserMedia
+                || navigator.mozGetUserMedia
+                || navigator.msGetUserMedia).bind(navigator);
 
     /**
      * Guacamole.ArrayBufferWriter wrapped around the audio output stream
@@ -420,7 +424,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
     var beginAudioCapture = function beginAudioCapture() {
 
         // Attempt to retrieve an audio input stream from the browser
-        getUserMedia({ 'audio' : true }, function streamReceived(stream) {
+        navigator.mediaDevices.getUserMedia({ 'audio' : true }, function streamReceived(stream) {
 
             // Create processing node which receives appropriately-sized audio buffers
             processor = context.createScriptProcessor(BUFFER_SIZE, format.channels, format.channels);