소스 검색

feat(RTC) drop no longer needed isDeviceListAvailable()

We require navigator.mediaDevices.enumerateDevices to exist.
master
Saúl Ibarra Corretgé 7 달 전
부모
커밋
62baeffd63

+ 0
- 10
JitsiMediaDevices.js 파일 보기

156
         RTC.enumerateDevices(callback);
156
         RTC.enumerateDevices(callback);
157
     }
157
     }
158
 
158
 
159
-    /**
160
-     * Checks if its possible to enumerate available cameras/micropones.
161
-     * @returns {Promise<boolean>} a Promise which will be resolved only once
162
-     * the WebRTC stack is ready, either with true if the device listing is
163
-     * available available or with false otherwise.
164
-     */
165
-    isDeviceListAvailable() {
166
-        return RTC.isDeviceListAvailable();
167
-    }
168
-
169
     /**
159
     /**
170
      * Returns true if changing the input (camera / microphone) or output
160
      * Returns true if changing the input (camera / microphone) or output
171
      * (audio) device is supported and false if not.
161
      * (audio) device is supported and false if not.

+ 0
- 8
modules/RTC/RTC.js 파일 보기

582
         return RTCUtils.attachMediaStream(elSelector, stream);
582
         return RTCUtils.attachMediaStream(elSelector, stream);
583
     }
583
     }
584
 
584
 
585
-    /**
586
-     * Returns true if retrieving the list of input devices is supported
587
-     * and false if not.
588
-     */
589
-    static isDeviceListAvailable() {
590
-        return RTCUtils.isDeviceListAvailable();
591
-    }
592
-
593
     /**
585
     /**
594
      * Returns true if changing the input (camera / microphone) or output
586
      * Returns true if changing the input (camera / microphone) or output
595
      * (audio) device is supported and false if not.
587
      * (audio) device is supported and false if not.

+ 22
- 36
modules/RTC/RTCUtils.js 파일 보기

281
 
281
 
282
         screenObtainer.init(options);
282
         screenObtainer.init(options);
283
 
283
 
284
-        if (this.isDeviceListAvailable()) {
285
-            this.enumerateDevices(ds => {
286
-                availableDevices = ds.slice(0);
287
-
288
-                logger.debug('Available devices: ', availableDevices);
289
-                sendDeviceListToAnalytics(availableDevices);
290
-
291
-                this.eventEmitter.emit(
292
-                    RTCEvents.DEVICE_LIST_AVAILABLE,
293
-                    availableDevices);
294
-
295
-                if (browser.supportsDeviceChangeEvent()) {
296
-                    navigator.mediaDevices.addEventListener(
297
-                        'devicechange',
298
-                        () => this.enumerateDevices(emptyFuncton));
299
-                } else {
300
-                    // Periodically poll enumerateDevices() method to check if
301
-                    // list of media devices has changed.
302
-                    availableDevicesPollTimer = window.setInterval(
303
-                        () => this.enumerateDevices(emptyFuncton),
304
-                        AVAILABLE_DEVICES_POLL_INTERVAL_TIME);
305
-                }
306
-            });
307
-        }
284
+        this.enumerateDevices(ds => {
285
+            availableDevices = ds.slice(0);
286
+
287
+            logger.debug('Available devices: ', availableDevices);
288
+            sendDeviceListToAnalytics(availableDevices);
289
+
290
+            this.eventEmitter.emit(
291
+                RTCEvents.DEVICE_LIST_AVAILABLE,
292
+                availableDevices);
293
+
294
+            if (browser.supportsDeviceChangeEvent()) {
295
+                navigator.mediaDevices.addEventListener(
296
+                    'devicechange',
297
+                    () => this.enumerateDevices(emptyFuncton));
298
+            } else {
299
+                // Periodically poll enumerateDevices() method to check if
300
+                // list of media devices has changed.
301
+                availableDevicesPollTimer = window.setInterval(
302
+                    () => this.enumerateDevices(emptyFuncton),
303
+                    AVAILABLE_DEVICES_POLL_INTERVAL_TIME);
304
+            }
305
+        });
308
     }
306
     }
309
 
307
 
310
     /**
308
     /**
709
             });
707
             });
710
     }
708
     }
711
 
709
 
712
-    /**
713
-     * Checks whether it is possible to enumerate available cameras/microphones.
714
-     *
715
-     * @returns {boolean} {@code true} if the device listing is available;
716
-     * {@code false}, otherwise.
717
-     */
718
-    isDeviceListAvailable() {
719
-        return Boolean(
720
-            navigator.mediaDevices
721
-                && navigator.mediaDevices.enumerateDevices);
722
-    }
723
-
724
     /**
710
     /**
725
      * Returns true if changing the input (camera / microphone) or output
711
      * Returns true if changing the input (camera / microphone) or output
726
      * (audio) device is supported and false if not.
712
      * (audio) device is supported and false if not.

+ 0
- 1
types/hand-crafted/JitsiMediaDevices.d.ts 파일 보기

2
 
2
 
3
 declare class JitsiMediaDevices {
3
 declare class JitsiMediaDevices {
4
   enumerateDevices: ( callback: ( devices: MediaDeviceInfo[] ) => void ) => void;
4
   enumerateDevices: ( callback: ( devices: MediaDeviceInfo[] ) => void ) => void;
5
-  isDeviceListAvailable: () => Promise<boolean>;
6
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
5
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
7
   isDevicePermissionGranted: ( type: MediaType ) => Promise<boolean>;
6
   isDevicePermissionGranted: ( type: MediaType ) => Promise<boolean>;
8
   isMultipleAudioInputSupported: () => boolean;
7
   isMultipleAudioInputSupported: () => boolean;

+ 0
- 4
types/hand-crafted/JitsiMeetJS.d.ts 파일 보기

124
 
124
 
125
   createLocalTracksFromMediaStreams: ( tracksInfo: unknown[] ) => JitsiLocalTrack[]; // TODO:
125
   createLocalTracksFromMediaStreams: ( tracksInfo: unknown[] ) => JitsiLocalTrack[]; // TODO:
126
 
126
 
127
-  // isDeviceListAvailable: () => boolean; // obsosete
128
-
129
-  // isDeviceChangeAvailable: ( deviceType: string ) => boolean; // obsosete
130
-
131
   isMultipleAudioInputSupported: () => boolean;
127
   isMultipleAudioInputSupported: () => boolean;
132
 
128
 
133
   isCollectingLocalStats: () => boolean;
129
   isCollectingLocalStats: () => boolean;

+ 0
- 1
types/hand-crafted/modules/RTC/RTC.d.ts 파일 보기

25
   setAudioMute: ( value: unknown ) => Promise<unknown>; // TODO:
25
   setAudioMute: ( value: unknown ) => Promise<unknown>; // TODO:
26
   removeLocalTrack: ( track: unknown ) => void; // TODO:
26
   removeLocalTrack: ( track: unknown ) => void; // TODO:
27
   static attachMediaStream: ( elSelector: unknown, stream: unknown ) => unknown; // TODO:
27
   static attachMediaStream: ( elSelector: unknown, stream: unknown ) => unknown; // TODO:
28
-  static isDeviceListAvailable: () => unknown; // TODO:
29
   static isDeviceChangeAvailable: ( deviceType: string ) => boolean; // TODO: check if deviceType should be an enum
28
   static isDeviceChangeAvailable: ( deviceType: string ) => boolean; // TODO: check if deviceType should be an enum
30
   static isWebRtcSupported: () => boolean;
29
   static isWebRtcSupported: () => boolean;
31
   static getAudioOutputDevice: () => string;
30
   static getAudioOutputDevice: () => string;

+ 0
- 1
types/hand-crafted/modules/RTC/RTCUtils.d.ts 파일 보기

5
   init: ( options: unknown ) => void; // TODO:
5
   init: ( options: unknown ) => void; // TODO:
6
   getUserMediaWithConstraints: ( um: MediaType[], options: { resolution: string, bandwidth: number, fps: number, desktopStream: string, cameraDeviceId: string, micDeviceId: string, frameRate: { min: unknown, max: unknown }, screenShareAudio: boolean, timeout: number } ) => Promise<unknown>; // TODO:
6
   getUserMediaWithConstraints: ( um: MediaType[], options: { resolution: string, bandwidth: number, fps: number, desktopStream: string, cameraDeviceId: string, micDeviceId: string, frameRate: { min: unknown, max: unknown }, screenShareAudio: boolean, timeout: number } ) => Promise<unknown>; // TODO:
7
   obtainAudioAndVideoPermissions: ( options: { devices: unknown[], resolution: string, cameraDeviceId: string, micDeviceId: string, desktopSharingFrameRate: { min: unknown, max: unknown } } ) => Promise<unknown>; // TODO:
7
   obtainAudioAndVideoPermissions: ( options: { devices: unknown[], resolution: string, cameraDeviceId: string, micDeviceId: string, desktopSharingFrameRate: { min: unknown, max: unknown } } ) => Promise<unknown>; // TODO:
8
-  isDeviceListAvailable: () => boolean;
9
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
8
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
10
   stopMediaStream: ( mediaStream: MediaStream ) => void;
9
   stopMediaStream: ( mediaStream: MediaStream ) => void;
11
   isDesktopSharingEnabled: () => boolean;
10
   isDesktopSharingEnabled: () => boolean;

Loading…
취소
저장