matrix-react-sdk
Version:
SDK for matrix.org using React
69 lines (68 loc) • 2.99 kB
TypeScript
import EventEmitter from "events";
export declare enum MediaDeviceKindEnum {
AudioOutput = "audiooutput",
AudioInput = "audioinput",
VideoInput = "videoinput"
}
export type IMediaDevices = Record<MediaDeviceKindEnum, Array<MediaDeviceInfo>>;
export declare enum MediaDeviceHandlerEvent {
AudioOutputChanged = "audio_output_changed"
}
export default class MediaDeviceHandler extends EventEmitter {
private static internalInstance?;
static get instance(): MediaDeviceHandler;
static hasAnyLabeledDevices(): Promise<boolean>;
/**
* Gets the available audio input/output and video input devices
* from the browser: a thin wrapper around mediaDevices.enumerateDevices()
* that also returns results by type of devices. Note that this requires
* user media permissions and an active stream, otherwise you'll get blank
* device labels.
*
* Once the Permissions API
* (https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)
* is ready for primetime, it might help make this simpler.
*
* @return Promise<IMediaDevices> The available media devices
*/
static getDevices(): Promise<IMediaDevices | undefined>;
static getDefaultDevice: (devices: Array<Partial<MediaDeviceInfo>>) => string;
/**
* Retrieves devices from the SettingsStore and tells the js-sdk to use them
*/
static loadDevices(): Promise<void>;
private static updateAudioSettings;
setAudioOutput(deviceId: string): void;
/**
* This will not change the device that a potential call uses. The call will
* need to be ended and started again for this change to take effect
* @param {string} deviceId
*/
setAudioInput(deviceId: string): Promise<void>;
/**
* This will not change the device that a potential call uses. The call will
* need to be ended and started again for this change to take effect
* @param {string} deviceId
*/
setVideoInput(deviceId: string): Promise<void>;
setDevice(deviceId: string, kind: MediaDeviceKindEnum): Promise<void>;
static setAudioAutoGainControl(value: boolean): Promise<void>;
static setAudioEchoCancellation(value: boolean): Promise<void>;
static setAudioNoiseSuppression(value: boolean): Promise<void>;
static getAudioOutput(): string;
static getAudioInput(): string;
static getVideoInput(): string;
static getAudioAutoGainControl(): boolean;
static getAudioEchoCancellation(): boolean;
static getAudioNoiseSuppression(): boolean;
/**
* Returns the current set deviceId for a device kind
* @param {MediaDeviceKindEnum} kind of the device that will be returned
* @returns {string} the deviceId
*/
static getDevice(kind: MediaDeviceKindEnum): string;
static get startWithAudioMuted(): boolean;
static set startWithAudioMuted(value: boolean);
static get startWithVideoMuted(): boolean;
static set startWithVideoMuted(value: boolean);
}