Преглед изворни кода

fix(gum): handle NotAllowedError (#646)

This is a two part fix:
- In the new gum flow, this.getUserMedia supports promises
  and rejections were not getting caught. So change
  _newGetUserMediaWithConstraints to be promise based instead
  of callback.
- The error name returned from blocked device permissions is
  NotAllowedError, as adapter shims PermissionDeniedError
  to be NotAllowedError.
tags/v0.0.2
virtuacoplenny пре 7 година
родитељ
комит
fb286a51a1
2 измењених фајлова са 5 додато и 5 уклоњено
  1. 1
    0
      JitsiTrackError.js
  2. 4
    5
      modules/RTC/RTCUtils.js

+ 1
- 0
JitsiTrackError.js Прегледај датотеку

@@ -74,6 +74,7 @@ function JitsiTrackError(error, options, devices) {
74 74
         };
75 75
 
76 76
         switch (error.name) {
77
+        case 'NotAllowedError':
77 78
         case 'PermissionDeniedError':
78 79
         case 'SecurityError':
79 80
             this.name = JitsiTrackErrors.PERMISSION_DENIED;

+ 4
- 5
modules/RTC/RTCUtils.js Прегледај датотеку

@@ -1190,9 +1190,8 @@ class RTCUtils extends Listenable {
1190 1190
     _newGetUserMediaWithConstraints(umDevices, constraints = {}) {
1191 1191
         return new Promise((resolve, reject) => {
1192 1192
             try {
1193
-                this.getUserMedia(
1194
-                    constraints,
1195
-                    stream => {
1193
+                this.getUserMedia(constraints)
1194
+                    .then(stream => {
1196 1195
                         logger.log('onUserMediaSuccess');
1197 1196
 
1198 1197
                         // TODO(brian): Is this call needed? Why is this
@@ -1201,8 +1200,8 @@ class RTCUtils extends Listenable {
1201 1200
                         setAvailableDevices(umDevices, stream);
1202 1201
 
1203 1202
                         resolve(stream);
1204
-                    },
1205
-                    error => {
1203
+                    })
1204
+                    .catch(error => {
1206 1205
                         logger.warn('Failed to get access to local media. '
1207 1206
                             + ` ${error} ${constraints} `);
1208 1207
 

Loading…
Откажи
Сачувај