Playlist

Voice.Playlist

A Playlist object allows you to specify a series of media which should be played in sequence. You can then pass the playlist to the methods that support it, for example Call.play.

Example

Creates a playlist for playing, in sequence, a TTS message, 1 second of silence, and an mp3 file.

const playlist = new Voice.Playlist({ volume: 1.0 })
  .add(Voice.Playlist.TTS({
    text: 'Welcome to SignalWire!',
  }))
  .add(Voice.Playlist.Silence({ duration: 1 }))
  .add(Voice.Playlist.Audio({
    url: 'https://cdn.signalwire.com/default-music/welcome.mp3'
  }))

Constructors

constructor

new Playlist(params?)

Parameters

NameType
paramsCreateVoicePlaylistParams

Accessors

media

get media(): NestedArray<VoiceCallPlayParams>

The media in this playlist.

Returns

NestedArray<VoiceCallPlayParams>


volume

get volume(): undefined | number

Default volume for the audio in the playlist.

Returns

undefined | number

Methods

add

add(params): Playlist

Adds a new media to the playlist

Parameters

NameType
paramsVoiceCallPlayParams

Returns

Playlist


Audio

Static Audio(params): VoiceCallPlayAudioParams

An audio media.

Parameters

Returns

VoiceCallPlayAudioParams


Ringtone

Static Ringtone(params): VoiceCallPlayRingtoneParams

A ringtone media.

Parameters

Returns

VoiceCallPlayRingtoneParams


Silence

Static Silence(params): VoiceCallPlaySilenceParams

A silence interval.

Parameters

Returns

VoiceCallPlaySilenceParams


TTS

Static TTS(params): VoiceCallPlayTTSParams

A TTS media.

Parameters

Returns

VoiceCallPlayTTSParams