/** * @module DeviceManagement */ import { Subscription } from 'rxjs'; import { RBEvent } from '../../models/event.model'; import { Service } from '../../services/service'; /** @internal */ export declare const DEVICE_MANAGEMENT_SVC = "DeviceManagementService"; /** * @eventProperty */ export declare enum DeviceManagementEvents { /** * @eventProperty * This RB event is send when the application cannot access the audio/video devices. The user should check the app / browser configuration and access to OS devices */ ON_AUDIO_VIDEO_DEVICE_ACCESS_ERROR = "rainbowonaudiovideodeviceaccesserror", /** * @eventProperty * This RB event is send when the application detects any kind of change in the devices list (audio input / output or video input devices) * **Event Data** * - **kind**: The kind of the device (audioinput, audiooutput or videoinput) * - **action**: Could be added (new device is added) / removed (device is removed) / updated (the id of the device has updated) */ ON_AUDIO_VIDEO_DEVICE_LIST_UPDATE = "rainbowonaudiovideodevicelistupdate", /** * @eventProperty * This RB event is send when a new device is selected to be used * **Event Data** * - **kind**: The kind of the device (audioinput, audiooutput or videoinput) * - **plugIn**: True if the new device is selected after a plug-in * - **plugOut**: True if the new device is selected after a plug-out of the current device used */ ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED = "rainbowonnewaudiovideodeviceselected", /** * @eventProperty * This RB event is send when a new secondary device is selected to be used; This is used only for incoming calls / IMs that could be played * also on the secondary device, if it's activated in the settings */ ON_NEW_SECONDARY_OUTPUT_DEVICE_SELECTED = "rainbowonnewsecondaryoutputdeviceselected" } export interface DeviceManagementService { /** * Return all available cameras */ getAllCameras(): MediaDeviceInfo[]; /** * Return all available microphones */ getAllMicrophones(): MediaDeviceInfo[]; /** * Return all available speakers */ getAllSpeakers(): MediaDeviceInfo[]; /** * Return the current selected microphone (that's used in all VoIP calls) */ getCurrentMicrophone(): MediaDeviceInfo; /** * Return the current selected speaker (that's used in all VoIP calls) */ getCurrentSpeaker(): MediaDeviceInfo | undefined; /** * Return the current selected camera (that's used in all VoIP calls) */ getCurrentCamera(): MediaDeviceInfo; /** * This API can be used to modify the current camera. This will result in sending * an update event of type ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param camera - The new device to be used; Should be of type videoinput */ setCurrentCamera(camera: MediaDeviceInfo): void; /** * This API can be used to modify the current speaker. This will result in sending * an update event of type DeviceManagementEvents.ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param speaker - The new device to be used; Should be of type audiooutput */ setCurrentSpeaker(speaker: MediaDeviceInfo): void; /** * This API can be used to modify the current microphone. This will result in sending * an update event of type ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param microphone - The new device to be used; Should be of type audioinput */ setCurrentMicrophone(microphone: MediaDeviceInfo): void; /** * Set the output speaker of the audio element with the given speaker. * This method is useful if you're developing an audio application and want to configure * the speaker to be used by an audio tag in the same way as Rainbow's audio tags. * @param element - The Audio element to whom we want to change the output ID * @param speaker - The speaker to be used */ setSpeakerForAudioElement(element: HTMLAudioElement, speaker: MediaDeviceInfo): Promise; /** * Subscribe to updates on the deviceManagement service (all events are of RBEvent type); * @param handler - The call-back function that will be subscribed to the RxJS subject * @param eventNames - a list of event names that the user wants to receive when subscribing (used a filter) */ subscribe(handler: (event: RBEvent) => any, eventNames?: DeviceManagementEvents | DeviceManagementEvents[]): Subscription; } /** * This service manages the input / output audio and video devices used by the application * @internal */ export declare class DeviceManagementServiceRB extends Service implements DeviceManagementService { private logger; private webrtcConfigAndUtils; private settingsService; private xmppService; private rxSubject; private deviceWatcher; private xmppConnectionSubscription; private audioInputDevices; private audioOutputDevices; private videoInputDevices; private currentAudioInputDevice; private currentAudioOutputDevice; private currentVideoInputDevice; private currentSecondaryOutputDevice; private getUserMediaForAudioDone; private getUserMediaForVideoDone; started: boolean; private manualAleDeviceSelection; static getInstance(): DeviceManagementServiceRB; static build(): DeviceManagementServiceRB; private constructor(); start(): Promise; stop(): Promise; /** * Subscribe to updates on the deviceManagement service (all events are of RBEvent type); * @param handler - The call-back function that will be subscribed to the RxJS subject * @param filterEvent - a list of event names that the user wants to receive when subscribing (used a filter) */ subscribe(handler: (event: RBEvent) => any, eventNames?: DeviceManagementEvents | DeviceManagementEvents[]): Subscription; private sendEvent; private devicesToIgnore; private inputDevicesToAcceptEvenWhenNotDefault; private arrayContains; private getHashFromLabel; private compareHashInLabel; /** * Set the output sinkID of the audio element with the output device given * @param element - The Audio element to whom we want to change the output ID * @param outputDevice - The output device to be used */ setSpeakerForAudioElement(element: HTMLAudioElement, outputDevice: MediaDeviceInfo): Promise; /** * Return the current audio input device selected (that's used in all VoIP calls) */ getCurrentMicrophone(): MediaDeviceInfo; /** * This API can be used to modify the current audio input device. This will result in sending an update event of type ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param device - The new device to be used; Should be of type audioinput */ setCurrentMicrophone(device: MediaDeviceInfo): void; /** * Return all available audio input devices (type MediaDeviceInfo) */ getAllMicrophones(): MediaDeviceInfo[]; /** * Return the current audio output device selected (that's used in all VoIP calls) */ getCurrentSpeaker(): MediaDeviceInfo | undefined; /** * This API can be used to modify the current audio output device. This will result in sending * an update event of type DeviceManagementEvents.ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param device - The new device to be used; Should be of type audiooutput */ setCurrentSpeaker(device: MediaDeviceInfo): void; /** * Return all available audio output devices (type MediaDeviceInfo) */ getAllSpeakers(): MediaDeviceInfo[]; /** * Return the current video input device selected (that's used in all VoIP calls) */ getCurrentCamera(): MediaDeviceInfo; /** * This API can be used to modify the currentvideo input device. This will result in sending an update * event of type ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param device - The new device to be used; Should be of type videoinput */ setCurrentCamera(device: MediaDeviceInfo): void; /** * Return all available video input devices (type MediaDeviceInfo) */ getAllCameras(): MediaDeviceInfo[]; /** * Return the secondary output device to be used for incoming calls / IMs to play sound on */ getCurrentSecondaryOutputDevice(): MediaDeviceInfo; /** * This API can be used to modify the currentvideo input device. This will result in sending * an update event of type DeviceManagementEvents.ON_NEW_AUDIO_VIDEO_DEVICE_SELECTED * @param device - The new device to be used; Should be of type audiooutput */ setCurrentSecondaryOutputDevice(device: MediaDeviceInfo): void; private startDeviceWatcher; checkDeviceList(): Promise; private testGetUserMedia; private isDeviceSelectedByDefaultByOS; private isAleManagedDevice; private updateAleManagedDeviceFlag; private getAleManagedDeviceFromList; /** * Called when we need to update the current audio input device (the device has been disconnected or null before) * We set the device to the "default" one by the system; * In case there're several devices with the same groupID, we choose the last one in the list; * @param tempAudioInputDevices - the list of audio input devices currently connected/detected */ private updateCurrentAudioInputDevice; /** * This function watches for any changes on the audio input devices list change; * Could be related to the number of input devices (connected or disconnected) or change of ID on some of the devices * @param tempAudioInputDevices - [required] the list of audio input devices currently connected/detected */ private updateCurrentAudioInputDevices; /** * Called when we need to update the current audio output device (the device has been disconnected or null before) * Try to find the same device as the current input device, if possible and then use it; Otherwise go to communiocations or default device; * @param tempAudioOutputDevices - the list of audio output devices currently connected/detected */ private updateCurrentAudioOutputDevice; private setGlobalTagSinkId; /** * This function watches for any changes on the audio output devices list change; * Could be related to the number of output devices (connected or disconnected) or change of ID on some of the devices * @param tempAudioOutputDevices - the list of audio output devices currently connected/detected */ private updateCurrentAudioOutputDevices; /** * Called when we need to update the current video input device (the device has been disconnected or null before) * @param tempVideoInputDevices - the list of video input devices currently connected/detected */ private updateCurrentVideoInputDevice; private updateCurrentVideoInputDevices; } //# sourceMappingURL=deviceManagement.service.d.ts.map