UNPKG

@twilio/voice-react-native-sdk

Version:
97 lines (83 loc) 2.41 kB
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** * Copyright © 2022 Twilio, Inc. All rights reserved. Licensed under the Twilio * license. * * See LICENSE in the project root for license information. */ import { NativeModule } from './common'; /** * Describes audio devices as reported by the native layer and allows the * native selection of the described audio device. * * @remarks * To fetch a list of available audio devices and the currently selected audio * device, see {@link (Voice:class).getAudioDevices}. * * - See also the {@link (AudioDevice:namespace) | AudioDevice namespace} for * types used by this class. * * @public */ export class AudioDevice { /** * The native-UUID of this object. This is generated by the native layer and * is used to associate functionality between the JS and native layers. * * @internal */ /** * The type of the audio device. */ /** * The name of the audio device. */ /** * Audio device class constructor. * @param audioDeviceInformation - A record describing an audio device. * * @internal */ constructor({ uuid, type, name }) { _defineProperty(this, "uuid", void 0); _defineProperty(this, "type", void 0); _defineProperty(this, "name", void 0); this.uuid = uuid; this.type = type; this.name = name; } /** * Calling this method will select this audio device as the active audio * device. * @returns * A `Promise` that * - Resolves with `void` when the audio device has been successfully * selected as the active audio device. * - Rejects if the audio device cannot be selected. */ select() { return NativeModule.voice_selectAudioDevice(this.uuid); } } /** * Contains interfaces and enumerations associated with audio devices. * * @remarks * - See also the {@link (AudioDevice:class) | AudioDevice class}. * * @public */ (function (_AudioDevice) { let Type; (function (Type) { Type["Earpiece"] = "earpiece"; Type["Speaker"] = "speaker"; Type["Bluetooth"] = "bluetooth"; })(Type || (Type = {})); _AudioDevice.Type = Type; })(AudioDevice || (AudioDevice = {})); //# sourceMappingURL=AudioDevice.js.map