RealtimeTTSPlayer
Constructors
Methods
addEventListener(event: , callback: Function
): void
Adds a handler for the specified PlayerEvents event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
Event class (i.e., PlayerEvents.PlaybackFinished)
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
clearBuffer(): void
Clears a Deepgram.RealtimeTTSPlayer buffer and resets the provider text/audio queue. Find more information in the documentation
Returns
type:
void
flush(): void
Forces the Deepgram provider to process all queued text and return the final audio immediately.
Sends { type: "Flush" } to the provider. Required when the text stream is finished but the WebSocket connection should remain open.
Find more information in the documentation
Returns
type:
void
id(): string
Returns the player's id.
Returns
type:
string
pause(): void
Pauses playback. To continue the playback use the Player.resume method.
Returns
type:
void
removeEventListener(event: , callback: Function
): void
Removes a handler for the specified PlayerEvents event.
Parameters
event:
Event class (i.e., PlayerEvents.PlaybackFinished)
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
sendMediaTo(mediaUnit: , parameters: ): void
Starts sending media from the player to the media unit.
Parameters
mediaUnit:
Media unit that receives media
parameters:
OptionalOptional. WebSocket interaction only parameters
Returns
type:
void
sendText(parameters: Object
): void
Sends a text message to the Deepgram provider Speak WebSocket connection.
Use this to append text for continuous speech generation. Find more information in the documentation.
Parameters
parameters:
Object
Object provides the parameters directly to the Deepgram provider Speak message. Find more information in the documentation
Returns
type:
void
stop(): void
Stops playback. The current player's instance is destroyed.
Returns
type:
void
stopMediaTo(mediaUnit: ): void
Stops sending media from the player to the media unit.
Parameters
mediaUnit:
Media unit that does not need to receive media from this conference anymore
Returns
type:
void