CallPlayback
Represents a current or past playback in a call.
Obtain instances of this class by starting a Playback with one of the following methods:
Example
Playing a text-to-speech message and waiting for it to end before proceeding to the next instructions.
Properties
The unique ID for this playback.
The current state of the playback.
Whether the playback has ended. Returns true if the state is "finished" or "error".
Methods
pause
- pause():
Promise<CallPlayback>
Pauses the playback.
Returns
Promise<CallPlayback>
A promise that is resolved only after the playback is paused.
Example
ended
- ended():
Promise<CallPlayback>
Waits for the playback to end.
Returns
Promise<CallPlayback>
A promise that is resolved to CallPlayback when the playback ends.
Example
resume
- resume():
Promise<CallPlayback>
Resumes the playback if it was paused.
Returns
Promise<CallPlayback>
A promise that is resolved to CallPlayback when the playback is resumed.
Example
setVolume
- setVolume(
volume):Promise<CallPlayback>
Changes the volume of the playback.
Parameters
Volume value between -40dB and +40dB.
Returns
Promise<CallPlayback>
A promise that is resolved to CallPlayback when the volume is changed.
Example
stop
- stop():
Promise<CallPlayback>
Stops the playback.
Returns
Promise<CallPlayback>
A promise that is resolved to CallPlayback when the playback is stopped.
Example
Events
onStarted
- CallPlayback.listen(
{ onStarted: Callback }})
Emitted when the playback starts playing. Your event handler will receive an instance of CallPlayback.
Parameters
The playback instance. See CallPlayback.
onUpdated
- CallPlayback.listen(
{ onUpdated: Callback }})
Emitted when the playback is updated. Your event handler will receive an instance of CallPlayback.
Parameters
The playback instance. See CallPlayback.
onFailed
- CallPlayback.listen(
{ onFailed: Callback }})
Emitted when the playback fails to start. Your event handler will receive an instance of CallPlayback.
Parameters
The playback instance. See CallPlayback.
onEnded
- CallPlayback.listen(
{ onEnded: Callback }})
Emitted when the playback finishes playing. Your event handler will receive an instance of CallPlayback.
Parameters
The playback instance. See CallPlayback.