Calling: Device Selection

This commit is contained in:
Josh Perez 2020-08-26 20:03:42 -04:00 committed by Josh Perez
parent 8b34294c97
commit 8ab1013f70
17 changed files with 1038 additions and 135 deletions

View file

@ -1,3 +1,15 @@
// Must be kept in sync with RingRTC.AudioDevice
export interface AudioDevice {
// Name, present on every platform.
name: string;
// Index of this device, starting from 0.
index: number;
// Index of this device out of all devices sharing the same name.
same_name_index: number;
// If present, a unique and stable identifier of this device. Only available on WIndows.
unique_id?: string;
}
// This must be kept in sync with RingRTC.CallState.
export enum CallState {
Prering = 'init',
@ -6,3 +18,23 @@ export enum CallState {
Reconnecting = 'connecting',
Ended = 'ended',
}
export enum CallingDeviceType {
CAMERA,
MICROPHONE,
SPEAKER,
}
export type MediaDeviceSettings = {
availableMicrophones: Array<AudioDevice>;
selectedMicrophone: AudioDevice | undefined;
availableSpeakers: Array<AudioDevice>;
selectedSpeaker: AudioDevice | undefined;
availableCameras: Array<MediaDeviceInfo>;
selectedCamera: string | undefined;
};
export type ChangeIODevicePayloadType =
| { type: CallingDeviceType.CAMERA; selectedDevice: string }
| { type: CallingDeviceType.MICROPHONE; selectedDevice: AudioDevice }
| { type: CallingDeviceType.SPEAKER; selectedDevice: AudioDevice };