Przeglądaj źródła

faet(ScreenObtainer): detect lack of permissions

Both of the cases where user clicks cancel and when screen recording
permissions were not granted at the OS level are almost the same,
except for a small difference in the error.message.

This was only tested on Chrome 85.0.4183.121/Mac OS 10.15.6
dev1
paweldomas 5 lat temu
rodzic
commit
f1a62f7cb9
1 zmienionych plików z 19 dodań i 3 usunięć
  1. 19
    3
      modules/RTC/ScreenObtainer.js

+ 19
- 3
modules/RTC/ScreenObtainer.js Wyświetl plik

@@ -185,9 +185,25 @@ const ScreenObtainer = {
185 185
                         sourceId: stream.id
186 186
                     }));
187 187
             })
188
-            .catch(() =>
189
-                errorCallback(new JitsiTrackError(JitsiTrackErrors
190
-                    .SCREENSHARING_USER_CANCELED)));
188
+            .catch(error => {
189
+                const errorDetails = {
190
+                    errorName: error && error.name,
191
+                    errorMsg: error && error.message,
192
+                    errorStack: error && error.stack
193
+                };
194
+
195
+                logger.error('getDisplayMedia error', errorDetails);
196
+
197
+                if (errorDetails.errorMsg && errorDetails.errorMsg.indexOf('denied by system') !== -1) {
198
+                    // On Chrome this is the only thing different between error returned when user cancels
199
+                    // and when no permission was given on the OS level.
200
+                    errorCallback(new JitsiTrackError(JitsiTrackErrors.PERMISSION_DENIED));
201
+
202
+                    return;
203
+                }
204
+
205
+                errorCallback(new JitsiTrackError(JitsiTrackErrors.SCREENSHARING_USER_CANCELED));
206
+            });
191 207
     }
192 208
 };
193 209
 

Ładowanie…
Anuluj
Zapisz