Skip to main content

Class: AudioOutput

A generic event target class designed for strongly-typed event handling. OdinEventTarget extends the functionality of the standard EventTarget to allow interactions with predefined event types and handlers.

Extends​

Constructors​

new AudioOutput()​

new AudioOutput(playback, _mediaData, peer, room): AudioOutput

Parameters​

• playback: AudioPlayback

The AudioPlayback that is provided by the underling plugin.

• _mediaData

• _mediaData.id: number

• _mediaData.paused: boolean

• _mediaData.properties: object | object

• peer: RemotePeer

• room: Room

Returns​

AudioOutput

Overrides​

OdinEventTarget.constructor

Defined in​

ari/lib/api/media/audio-output.d.ts:41

Properties​

kind​

readonly kind: "audio-output" = "audio-output"

Defined in​

ari/lib/api/media/audio-output.d.ts:20


onAudioActivity()?​

optional onAudioActivity: (payload) => void

A callback function that is invoked when audio activity occurs and voice activity detection (VAD) was set to true.

Parameters​

• payload: boolean

An object containing the AudioMedia.

Returns​

void

Defined in​

ari/lib/api/media/audio-output.d.ts:26


onJitterStats()?​

optional onJitterStats: (payload) => void

Optional callback function that is invoked to handle jitter statistics.

Parameters​

• payload: JitterStats

The object containing metrics or data related to jitter statistics.

Returns​

void

Defined in​

ari/lib/api/media/audio-output.d.ts:40


onPowerLevel()?​

optional onPowerLevel: (payload) => void

A callback function invoked when there is an update to the audio power level in rmsDBFS. This function can be used to handle or process audio activity, such as monitoring sound levels or visualizing audio input.

Parameters​

• payload: number

An object containing the AudioMedia.

Returns​

void

Defined in​

ari/lib/api/media/audio-output.d.ts:34


peer​

readonly peer: RemotePeer

Defined in​

ari/lib/api/media/audio-output.d.ts:18


playback​

readonly playback: AudioPlayback

The AudioPlayback that is provided by the underling plugin.

Defined in​

ari/lib/api/media/audio-output.d.ts:16


room​

readonly room: Room

Defined in​

ari/lib/api/media/audio-output.d.ts:19

Accessors​

customType​

get customType(): string

The custom type helps to identify the purpose of the VideoOutput that was defined by the remote AudioInput.

Returns​

string

The custom type value if available; otherwise, undefined.

Defined in​

ari/lib/api/media/audio-output.d.ts:73


isActive​

get isActive(): boolean

Whether the AudioOutput is currently active or not. Only works when voice activity detection was enabled.

Returns​

boolean

True if the instance is active, false otherwise.

Defined in​

ari/lib/api/media/audio-output.d.ts:66


isPaused​

get isPaused(): boolean

Retrieves the paused state of the object.

Returns​

boolean

Returns true if the object is in a paused state, otherwise false.

Defined in​

ari/lib/api/media/audio-output.d.ts:100


jitterStats​

get jitterStats(): JitterStats

Retrieves the jitter statistics for the playback.

Returns​

JitterStats

The jitter statistics data associated with the playback.

Defined in​

ari/lib/api/media/audio-output.d.ts:114


mediaId​

get mediaId(): number

Retrieves the media ID associated with this instance.

Returns​

number

The unique identifier of the media.

Defined in​

ari/lib/api/media/audio-output.d.ts:59


powerLevel​

get powerLevel(): number

Retrieves the Root Mean Square (RMS) in decibels relative to full scale (dBFS) for the captured audio activity. This is a measure of the average power level of the audio signal.

Returns​

number

The RMS value expressed in dBFS.

Defined in​

ari/lib/api/media/audio-output.d.ts:108


uid​

get uid(): string

Retrieves the unique identifier (UID) associated with the playback.

Returns​

string

The UID of the playback.

Defined in​

ari/lib/api/media/audio-output.d.ts:53


volume​

get volume(): OutputVolume

Retrieves the current volume.

Returns​

OutputVolume

The volume number or 'muted'.

Defined in​

ari/lib/api/media/audio-output.d.ts:79


volumeAggregated​

get volumeAggregated(): number

Gets the aggregated volume (room * peer * audioOutput) that is currently in use.

Returns​

number

The current aggregated volume level, or 0 if volume is not defined.

Defined in​

ari/lib/api/media/audio-output.d.ts:85

Methods​

addEventListener()​

addEventListener<OdinEventType>(eventName, handler, options?): void

Type Parameters​

• OdinEventType extends keyof MediaEvents

Parameters​

• eventName: OdinEventType

• handler: MediaEvents[OdinEventType]

• options?: boolean | AddEventListenerOptions

Returns​

void

Inherited from​

OdinEventTarget.addEventListener

Defined in​

ari/lib/utils/odin-event-target.d.ts:26


close()​

close(): void

Closes the AudioOutput.

Returns​

void

Defined in​

ari/lib/api/media/audio-output.d.ts:128


dispatchEvent()​

dispatchEvent<T>(event): void

Type Parameters​

• T extends OdinEvent<any>

Parameters​

• event: T

Returns​

void

Inherited from​

OdinEventTarget.dispatchEvent

Defined in​

ari/lib/utils/odin-event-target.d.ts:27


pause()​

pause(): Promise<void>

Pauses the AudioOutput at the SFU and prevents receiving audio packets

Returns​

Promise<void>

A promise that resolves when the media is successfully paused.

Defined in​

ari/lib/api/media/audio-output.d.ts:120


removeEventListener()​

removeEventListener<OdinEventType>(type, callback): void

Type Parameters​

• OdinEventType extends keyof MediaEvents

Parameters​

• type: string | OdinEventType

• callback: EventListenerOrEventListenerObject | MediaEvents[OdinEventType]

Returns​

void

Inherited from​

OdinEventTarget.removeEventListener

Defined in​

ari/lib/utils/odin-event-target.d.ts:28


resume()​

resume(): Promise<void>

Resumes the AudioOutput at the SFU.

Returns​

Promise<void>

Defined in​

ari/lib/api/media/audio-output.d.ts:124


setVolume()​

setVolume(value?): Promise<void>

Sets the volume of the AudioOutput.

The volume value should be between 0 and 2 (inclusive). Values outside this range are clamped.

Parameters​

• value?: number | OutputVolume

The desired volume setting. It can be a specific volume level or 'muted'.

Returns​

Promise<void>

A promise that resolves when the volume adjustment is complete.

Defined in​

ari/lib/api/media/audio-output.d.ts:94