Browse Source

feat(RTC) drop no longer needed isDeviceListAvailable()

We require navigator.mediaDevices.enumerateDevices to exist.
master
Saúl Ibarra Corretgé 7 months ago
parent
commit
62baeffd63

+ 0
- 10
JitsiMediaDevices.js View File

@@ -156,16 +156,6 @@ class JitsiMediaDevices extends Listenable {
156 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 160
      * Returns true if changing the input (camera / microphone) or output
171 161
      * (audio) device is supported and false if not.

+ 0
- 8
modules/RTC/RTC.js View File

@@ -582,14 +582,6 @@ export default class RTC extends Listenable {
582 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 586
      * Returns true if changing the input (camera / microphone) or output
595 587
      * (audio) device is supported and false if not.

+ 22
- 36
modules/RTC/RTCUtils.js View File

@@ -281,30 +281,28 @@ class RTCUtils extends Listenable {
281 281
 
282 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,18 +707,6 @@ class RTCUtils extends Listenable {
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 711
      * Returns true if changing the input (camera / microphone) or output
726 712
      * (audio) device is supported and false if not.

+ 0
- 1
types/hand-crafted/JitsiMediaDevices.d.ts View File

@@ -2,7 +2,6 @@ import { MediaType } from './service/RTC/MediaType';
2 2
 
3 3
 declare class JitsiMediaDevices {
4 4
   enumerateDevices: ( callback: ( devices: MediaDeviceInfo[] ) => void ) => void;
5
-  isDeviceListAvailable: () => Promise<boolean>;
6 5
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
7 6
   isDevicePermissionGranted: ( type: MediaType ) => Promise<boolean>;
8 7
   isMultipleAudioInputSupported: () => boolean;

+ 0
- 4
types/hand-crafted/JitsiMeetJS.d.ts View File

@@ -124,10 +124,6 @@ export type JitsiMeetJSType = {
124 124
 
125 125
   createLocalTracksFromMediaStreams: ( tracksInfo: unknown[] ) => JitsiLocalTrack[]; // TODO:
126 126
 
127
-  // isDeviceListAvailable: () => boolean; // obsosete
128
-
129
-  // isDeviceChangeAvailable: ( deviceType: string ) => boolean; // obsosete
130
-
131 127
   isMultipleAudioInputSupported: () => boolean;
132 128
 
133 129
   isCollectingLocalStats: () => boolean;

+ 0
- 1
types/hand-crafted/modules/RTC/RTC.d.ts View File

@@ -25,7 +25,6 @@ export default class RTC extends Listenable {
25 25
   setAudioMute: ( value: unknown ) => Promise<unknown>; // TODO:
26 26
   removeLocalTrack: ( track: unknown ) => void; // TODO:
27 27
   static attachMediaStream: ( elSelector: unknown, stream: unknown ) => unknown; // TODO:
28
-  static isDeviceListAvailable: () => unknown; // TODO:
29 28
   static isDeviceChangeAvailable: ( deviceType: string ) => boolean; // TODO: check if deviceType should be an enum
30 29
   static isWebRtcSupported: () => boolean;
31 30
   static getAudioOutputDevice: () => string;

+ 0
- 1
types/hand-crafted/modules/RTC/RTCUtils.d.ts View File

@@ -5,7 +5,6 @@ declare class RTCUtils extends Listenable {
5 5
   init: ( options: unknown ) => void; // TODO:
6 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 7
   obtainAudioAndVideoPermissions: ( options: { devices: unknown[], resolution: string, cameraDeviceId: string, micDeviceId: string, desktopSharingFrameRate: { min: unknown, max: unknown } } ) => Promise<unknown>; // TODO:
8
-  isDeviceListAvailable: () => boolean;
9 8
   isDeviceChangeAvailable: ( deviceType: string ) => boolean;
10 9
   stopMediaStream: ( mediaStream: MediaStream ) => void;
11 10
   isDesktopSharingEnabled: () => boolean;

Loading…
Cancel
Save