Browse Source

feat(createLocalTracks) drop unused slow gUM event

It's better handled by the application layer anyway.
release-8443
Saúl Ibarra Corretgé 1 year ago
parent
commit
91028a6dfd

+ 0
- 3
JitsiMediaDevicesEvents.spec.ts View File

7
         DEVICE_LIST_CHANGED,
7
         DEVICE_LIST_CHANGED,
8
         PERMISSIONS_CHANGED,
8
         PERMISSIONS_CHANGED,
9
         PERMISSION_PROMPT_IS_SHOWN,
9
         PERMISSION_PROMPT_IS_SHOWN,
10
-        SLOW_GET_USER_MEDIA,
11
         JitsiMediaDevicesEvents,
10
         JitsiMediaDevicesEvents,
12
         ...others
11
         ...others
13
     } = exported;
12
     } = exported;
16
         expect( DEVICE_LIST_CHANGED ).toBe( 'mediaDevices.devicechange' );
15
         expect( DEVICE_LIST_CHANGED ).toBe( 'mediaDevices.devicechange' );
17
         expect( PERMISSIONS_CHANGED ).toBe( 'rtc.permissions_changed' );
16
         expect( PERMISSIONS_CHANGED ).toBe( 'rtc.permissions_changed' );
18
         expect( PERMISSION_PROMPT_IS_SHOWN ).toBe( 'mediaDevices.permissionPromptIsShown' );
17
         expect( PERMISSION_PROMPT_IS_SHOWN ).toBe( 'mediaDevices.permissionPromptIsShown' );
19
-        expect( SLOW_GET_USER_MEDIA ).toBe( 'mediaDevices.slowGetUserMedia' );
20
 
18
 
21
         expect( JitsiMediaDevicesEvents ).toBeDefined();
19
         expect( JitsiMediaDevicesEvents ).toBeDefined();
22
 
20
 
23
         expect( JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED ).toBe( 'mediaDevices.devicechange' );
21
         expect( JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED ).toBe( 'mediaDevices.devicechange' );
24
         expect( JitsiMediaDevicesEvents.PERMISSIONS_CHANGED ).toBe( 'rtc.permissions_changed' );
22
         expect( JitsiMediaDevicesEvents.PERMISSIONS_CHANGED ).toBe( 'rtc.permissions_changed' );
25
         expect( JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN ).toBe( 'mediaDevices.permissionPromptIsShown' );
23
         expect( JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN ).toBe( 'mediaDevices.permissionPromptIsShown' );
26
-        expect( JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA ).toBe( 'mediaDevices.slowGetUserMedia' );
27
     } );
24
     } );
28
 
25
 
29
     it( "unknown members", () => {
26
     it( "unknown members", () => {

+ 1
- 4
JitsiMediaDevicesEvents.ts View File

29
      *  |'react-native'|'android'} environmentType - type of browser or
29
      *  |'react-native'|'android'} environmentType - type of browser or
30
      *  other execution environment.
30
      *  other execution environment.
31
      */
31
      */
32
-    PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown',
33
-
34
-    SLOW_GET_USER_MEDIA = 'mediaDevices.slowGetUserMedia'
32
+    PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown'
35
 };
33
 };
36
 
34
 
37
 // exported for backward compatibility
35
 // exported for backward compatibility
38
 export const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
36
 export const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
39
 export const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
37
 export const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
40
 export const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
38
 export const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
41
-export const SLOW_GET_USER_MEDIA = JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA;

+ 1
- 20
JitsiMeetJS.ts View File

38
 
38
 
39
 const logger = Logger.getLogger(__filename);
39
 const logger = Logger.getLogger(__filename);
40
 
40
 
41
-/**
42
- * The amount of time to wait until firing
43
- * {@link JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN} event.
44
- */
45
-const USER_MEDIA_SLOW_PROMISE_TIMEOUT = 1000;
46
-
47
 /**
41
 /**
48
  * Indicates whether GUM has been executed or not.
42
  * Indicates whether GUM has been executed or not.
49
  */
43
  */
278
      * @param {Array} options.effects optional effects array for the track
272
      * @param {Array} options.effects optional effects array for the track
279
      * @param {boolean} options.firePermissionPromptIsShownEvent - if event
273
      * @param {boolean} options.firePermissionPromptIsShownEvent - if event
280
      * JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN should be fired
274
      * JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN should be fired
281
-     * @param {boolean} options.fireSlowPromiseEvent - if event
282
-     * JitsiMediaDevicesEvents.USER_MEDIA_SLOW_PROMISE_TIMEOUT should be fired
283
      * @param {Array} options.devices the devices that will be requested
275
      * @param {Array} options.devices the devices that will be requested
284
      * @param {string} options.resolution resolution constraints
276
      * @param {string} options.resolution resolution constraints
285
      * @param {string} options.cameraDeviceId
277
      * @param {string} options.cameraDeviceId
290
      * JitsiConferenceError if rejected.
282
      * JitsiConferenceError if rejected.
291
      */
283
      */
292
     createLocalTracks(options: ICreateLocalTrackOptions = {}) {
284
     createLocalTracks(options: ICreateLocalTrackOptions = {}) {
293
-        let promiseFulfilled = false;
294
-        const { firePermissionPromptIsShownEvent, fireSlowPromiseEvent, ...restOptions } = options;
285
+        const { firePermissionPromptIsShownEvent, ...restOptions } = options;
295
 
286
 
296
         if (firePermissionPromptIsShownEvent && !RTC.arePermissionsGrantedForAvailableDevices()) {
287
         if (firePermissionPromptIsShownEvent && !RTC.arePermissionsGrantedForAvailableDevices()) {
297
             // @ts-ignore
288
             // @ts-ignore
298
             JitsiMediaDevices.emit(JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN, browser.getName());
289
             JitsiMediaDevices.emit(JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN, browser.getName());
299
-        } else if (fireSlowPromiseEvent) {
300
-            window.setTimeout(() => {
301
-                if (!promiseFulfilled) {
302
-                    JitsiMediaDevices.emit(JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA);
303
-                }
304
-            }, USER_MEDIA_SLOW_PROMISE_TIMEOUT);
305
         }
290
         }
306
 
291
 
307
         let isFirstGUM = false;
292
         let isFirstGUM = false;
320
 
305
 
321
         return RTC.obtainAudioAndVideoPermissions(restOptions)
306
         return RTC.obtainAudioAndVideoPermissions(restOptions)
322
             .then(tracks => {
307
             .then(tracks => {
323
-                promiseFulfilled = true;
324
-
325
                 let endTS = window.performance.now();
308
                 let endTS = window.performance.now();
326
 
309
 
327
                 window.connectionTimes['obtainPermissions.end'] = endTS;
310
                 window.connectionTimes['obtainPermissions.end'] = endTS;
362
                 return tracks;
345
                 return tracks;
363
             })
346
             })
364
             .catch(error => {
347
             .catch(error => {
365
-                promiseFulfilled = true;
366
-
367
                 if (error.name === JitsiTrackErrors.SCREENSHARING_USER_CANCELED) {
348
                 if (error.name === JitsiTrackErrors.SCREENSHARING_USER_CANCELED) {
368
                     Statistics.sendAnalytics(
349
                     Statistics.sendAnalytics(
369
                         createGetUserMediaEvent(
350
                         createGetUserMediaEvent(

+ 1
- 2
types/hand-crafted/JitsiMediaDevicesEvents.d.ts View File

1
 export enum JitsiMediaDevicesEvents {
1
 export enum JitsiMediaDevicesEvents {
2
   DEVICE_LIST_CHANGED = 'mediaDevices.devicechange',
2
   DEVICE_LIST_CHANGED = 'mediaDevices.devicechange',
3
   PERMISSIONS_CHANGED = 'rtc.permissions_changed',
3
   PERMISSIONS_CHANGED = 'rtc.permissions_changed',
4
-  PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown',
5
-  SLOW_GET_USER_MEDIA = 'mediaDevices.slowGetUserMedia'
4
+  PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown'
6
 }
5
 }

Loading…
Cancel
Save