Browse Source

feat(ts) TypeScript enum for JitsiMediaDevicesEvents

tags/v0.0.2
Gary Hunt 2 years ago
parent
commit
581ee807f7
No account linked to committer's email address
3 changed files with 73 additions and 60 deletions
  1. 0
    34
      JitsiMediaDevicesEvents.js
  2. 41
    0
      JitsiMediaDevicesEvents.ts
  3. 32
    26
      types/auto/JitsiMediaDevicesEvents.d.ts

+ 0
- 34
JitsiMediaDevicesEvents.js View File

@@ -1,34 +0,0 @@
1
-/**
2
- * The events for the media devices.
3
- */
4
-
5
-/**
6
- * Indicates that the list of available media devices has been changed. The
7
- * event provides the following parameters to its listeners:
8
- *
9
- * @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
10
- *  MediaDeviceInfo-like objects that are currently connected.
11
- *  @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
12
- */
13
-export const DEVICE_LIST_CHANGED = 'mediaDevices.devicechange';
14
-
15
-/**
16
- * Event emitted when the user granted/blocked a permission for the camera / mic.
17
- * Used to keep track of the granted permissions on browsers which don't
18
- * support the Permissions API.
19
- */
20
-export const PERMISSIONS_CHANGED = 'rtc.permissions_changed';
21
-
22
-/**
23
- * Indicates that the environment is currently showing permission prompt to
24
- * access camera and/or microphone. The event provides the following
25
- * parameters to its listeners:
26
- *
27
- * @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
28
- *  |'react-native'|'android'} environmentType - type of browser or
29
- *  other execution environment.
30
- */
31
-export const PERMISSION_PROMPT_IS_SHOWN
32
-    = 'mediaDevices.permissionPromptIsShown';
33
-
34
-export const SLOW_GET_USER_MEDIA = 'mediaDevices.slowGetUserMedia';

+ 41
- 0
JitsiMediaDevicesEvents.ts View File

@@ -0,0 +1,41 @@
1
+/**
2
+ * The events for the media devices.
3
+ */
4
+
5
+export enum JitsiMediaDevicesEvents {
6
+    /**
7
+     * Indicates that the list of available media devices has been changed. The
8
+     * event provides the following parameters to its listeners:
9
+     *
10
+     * @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
11
+     *  MediaDeviceInfo-like objects that are currently connected.
12
+     *  @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
13
+     */
14
+    DEVICE_LIST_CHANGED = 'mediaDevices.devicechange',
15
+
16
+    /**
17
+     * Event emitted when the user granted/blocked a permission for the camera / mic.
18
+     * Used to keep track of the granted permissions on browsers which don't
19
+     * support the Permissions API.
20
+     */
21
+    PERMISSIONS_CHANGED = 'rtc.permissions_changed',
22
+
23
+    /**
24
+     * Indicates that the environment is currently showing permission prompt to
25
+     * access camera and/or microphone. The event provides the following
26
+     * parameters to its listeners:
27
+     *
28
+     * @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
29
+     *  |'react-native'|'android'} environmentType - type of browser or
30
+     *  other execution environment.
31
+     */
32
+    PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown',
33
+
34
+    SLOW_GET_USER_MEDIA = 'mediaDevices.slowGetUserMedia'
35
+};
36
+
37
+// exported for backward compatibility
38
+export const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
39
+export const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
40
+export const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
41
+export const SLOW_GET_USER_MEDIA = JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA;

+ 32
- 26
types/auto/JitsiMediaDevicesEvents.d.ts View File

@@ -1,29 +1,35 @@
1 1
 /**
2 2
  * The events for the media devices.
3 3
  */
4
-/**
5
- * Indicates that the list of available media devices has been changed. The
6
- * event provides the following parameters to its listeners:
7
- *
8
- * @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
9
- *  MediaDeviceInfo-like objects that are currently connected.
10
- *  @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
11
- */
12
-export const DEVICE_LIST_CHANGED: "mediaDevices.devicechange";
13
-/**
14
- * Event emitted when the user granted/blocked a permission for the camera / mic.
15
- * Used to keep track of the granted permissions on browsers which don't
16
- * support the Permissions API.
17
- */
18
-export const PERMISSIONS_CHANGED: "rtc.permissions_changed";
19
-/**
20
- * Indicates that the environment is currently showing permission prompt to
21
- * access camera and/or microphone. The event provides the following
22
- * parameters to its listeners:
23
- *
24
- * @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
25
- *  |'react-native'|'android'} environmentType - type of browser or
26
- *  other execution environment.
27
- */
28
-export const PERMISSION_PROMPT_IS_SHOWN: "mediaDevices.permissionPromptIsShown";
29
-export const SLOW_GET_USER_MEDIA: "mediaDevices.slowGetUserMedia";
4
+export declare enum JitsiMediaDevicesEvents {
5
+    /**
6
+     * Indicates that the list of available media devices has been changed. The
7
+     * event provides the following parameters to its listeners:
8
+     *
9
+     * @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
10
+     *  MediaDeviceInfo-like objects that are currently connected.
11
+     *  @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
12
+     */
13
+    DEVICE_LIST_CHANGED = "mediaDevices.devicechange",
14
+    /**
15
+     * Event emitted when the user granted/blocked a permission for the camera / mic.
16
+     * Used to keep track of the granted permissions on browsers which don't
17
+     * support the Permissions API.
18
+     */
19
+    PERMISSIONS_CHANGED = "rtc.permissions_changed",
20
+    /**
21
+     * Indicates that the environment is currently showing permission prompt to
22
+     * access camera and/or microphone. The event provides the following
23
+     * parameters to its listeners:
24
+     *
25
+     * @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
26
+     *  |'react-native'|'android'} environmentType - type of browser or
27
+     *  other execution environment.
28
+     */
29
+    PERMISSION_PROMPT_IS_SHOWN = "mediaDevices.permissionPromptIsShown",
30
+    SLOW_GET_USER_MEDIA = "mediaDevices.slowGetUserMedia"
31
+}
32
+export declare const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
33
+export declare const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
34
+export declare const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
35
+export declare const SLOW_GET_USER_MEDIA = JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA;

Loading…
Cancel
Save