Skip to content

Commit

Permalink
feat(ts) TypeScript enum for JitsiMediaDevicesEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
garyhuntddn authored Feb 21, 2022
1 parent 9123f34 commit 581ee80
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 60 deletions.
34 changes: 0 additions & 34 deletions JitsiMediaDevicesEvents.js

This file was deleted.

41 changes: 41 additions & 0 deletions JitsiMediaDevicesEvents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* The events for the media devices.
*/

export enum JitsiMediaDevicesEvents {
/**
* Indicates that the list of available media devices has been changed. The
* event provides the following parameters to its listeners:
*
* @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
* MediaDeviceInfo-like objects that are currently connected.
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
*/
DEVICE_LIST_CHANGED = 'mediaDevices.devicechange',

/**
* Event emitted when the user granted/blocked a permission for the camera / mic.
* Used to keep track of the granted permissions on browsers which don't
* support the Permissions API.
*/
PERMISSIONS_CHANGED = 'rtc.permissions_changed',

/**
* Indicates that the environment is currently showing permission prompt to
* access camera and/or microphone. The event provides the following
* parameters to its listeners:
*
* @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
* |'react-native'|'android'} environmentType - type of browser or
* other execution environment.
*/
PERMISSION_PROMPT_IS_SHOWN = 'mediaDevices.permissionPromptIsShown',

SLOW_GET_USER_MEDIA = 'mediaDevices.slowGetUserMedia'
};

// exported for backward compatibility
export const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
export const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
export const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
export const SLOW_GET_USER_MEDIA = JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA;
58 changes: 32 additions & 26 deletions types/auto/JitsiMediaDevicesEvents.d.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
/**
* The events for the media devices.
*/
/**
* Indicates that the list of available media devices has been changed. The
* event provides the following parameters to its listeners:
*
* @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
* MediaDeviceInfo-like objects that are currently connected.
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
*/
export const DEVICE_LIST_CHANGED: "mediaDevices.devicechange";
/**
* Event emitted when the user granted/blocked a permission for the camera / mic.
* Used to keep track of the granted permissions on browsers which don't
* support the Permissions API.
*/
export const PERMISSIONS_CHANGED: "rtc.permissions_changed";
/**
* Indicates that the environment is currently showing permission prompt to
* access camera and/or microphone. The event provides the following
* parameters to its listeners:
*
* @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
* |'react-native'|'android'} environmentType - type of browser or
* other execution environment.
*/
export const PERMISSION_PROMPT_IS_SHOWN: "mediaDevices.permissionPromptIsShown";
export const SLOW_GET_USER_MEDIA: "mediaDevices.slowGetUserMedia";
export declare enum JitsiMediaDevicesEvents {
/**
* Indicates that the list of available media devices has been changed. The
* event provides the following parameters to its listeners:
*
* @param {MediaDeviceInfo[]} devices - array of MediaDeviceInfo or
* MediaDeviceInfo-like objects that are currently connected.
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo
*/
DEVICE_LIST_CHANGED = "mediaDevices.devicechange",
/**
* Event emitted when the user granted/blocked a permission for the camera / mic.
* Used to keep track of the granted permissions on browsers which don't
* support the Permissions API.
*/
PERMISSIONS_CHANGED = "rtc.permissions_changed",
/**
* Indicates that the environment is currently showing permission prompt to
* access camera and/or microphone. The event provides the following
* parameters to its listeners:
*
* @param {'chrome'|'opera'|'firefox'|'safari'|'nwjs'
* |'react-native'|'android'} environmentType - type of browser or
* other execution environment.
*/
PERMISSION_PROMPT_IS_SHOWN = "mediaDevices.permissionPromptIsShown",
SLOW_GET_USER_MEDIA = "mediaDevices.slowGetUserMedia"
}
export declare const DEVICE_LIST_CHANGED = JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED;
export declare const PERMISSIONS_CHANGED = JitsiMediaDevicesEvents.PERMISSIONS_CHANGED;
export declare const PERMISSION_PROMPT_IS_SHOWN = JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN;
export declare const SLOW_GET_USER_MEDIA = JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA;

0 comments on commit 581ee80

Please sign in to comment.