Skip to main content

CallPlayback

Represents a current or past playback in a call.

Accessors

id

get id(): string

The unique id for this playback.

Returns

string

Methods

pause

pause(): Promise<CallPlayback>

Pauses the playback.

Returns

Promise<CallPlayback>

Example

const playback = await call.playAudio({
url: "https://cdn.signalwire.com/default-music/welcome.mp3",
});
await playback.pause();

ended

ended(): Promise<CallPlayback>

Returns a promise that is resolved only after this playback finishes playing (or is stopped).

Returns

Promise<CallPlayback>

Example

const playback = await call.playAudio({
url: "https://cdn.signalwire.com/default-music/welcome.mp3",
});
await playback.ended();

resume

resume(): Promise<CallPlayback>

Resumes the playback if it was paused.

Returns

Promise<CallPlayback>

Example

const playback = await call.playAudio({
url: "https://cdn.signalwire.com/default-music/welcome.mp3",
});
await playback.resume();

setVolume

setVolume(volume): Promise<CallPlayback>

Changes the volume of the playback.

Parameters

NameTypeDescription
volumenumberVolume value between -40dB and +40dB.

Returns

Promise<CallPlayback>

Example

const playback = await call.playAudio({
url: "https://cdn.signalwire.com/default-music/welcome.mp3",
});
await playback.setVolume(-20);

stop

stop(): Promise<CallPlayback>

Stops the playback.

Returns

Promise<CallPlayback>

Example

const playback = await call.playAudio({
url: "https://cdn.signalwire.com/default-music/welcome.mp3",
});
await playback.stop();

waitForEnded

waitForEnded(): Promise<CallPlayback>

Returns a promise that is resolved only after this playback finishes playing (or is stopped).

caution

This method is deprecated. See ended instead.