A class that represents an actual physical or virtual audio device.

Hierarchy

  • Device

Constructors

Properties

Methods

Constructors

Properties

balance: VolumeBalance

The stereo balance of the device if available.

mute: boolean

A flag indicating the mute state of a device.

Remarks

Writing to this property changes the mute state of the device.

name: string

The name of the device.

sessions: AudioSession[]

Returns the audio sessions bound to the device.

The type of the device (input or output).

volume: number

The current volume of the device.

Remarks

Writing to this property changes the volume of the device.

Methods

  • Returns

    • The id of the registered callback used to remove the listener.

    Remarks

    Triggering a volume change, or mute change in a callback can cause the listeners to self trigger, leading to an infinite trigger loop.

    See

    removing a listener

    Parameters

    • ev: string

      The type of event to subscribe to. It can be either volume, or mute.

    • callback: ((payload: any) => void)

      The callback to run when the event is triggered.

        • (payload: any): void
        • Parameters

          • payload: any

          Returns void

    Returns number

  • Returns

    • Whether the callback was unregistered or not.

    See

    registering a listener

    Parameters

    • ev: string

      The type of event to remove the listener of.

    • handler: number

      The identifier of the registered callback to be removed.

    Returns boolean

Generated using TypeDoc