RealtimeTTSPlayer
Extends: BasePlayer
Methods
clearBuffer
Clears the local playback buffer.
Sarvam has no cancel message. Call Sarvam.RealtimeTTSPlayer.stop to close the player, then create a new player for the next utterance.
configure
Sends a new config message on the same player.
The model is fixed by the first config and must not change. speaker may change. A config update flushes text that is still buffered.
Parameters
flush
Forces Sarvam to synthesize the buffered text, including text shorter than min_buffer_size.
Sends { type: "flush" }. PlayerEvents.PlaybackFinished is delivered once for each flush, including a flush with no pending text. It is not delivered when text is sent without flush. Find more information in the documentation.
sendText
Sends a text message to the Sarvam streaming TTS WebSocket.
Text shorter than min_buffer_size stays buffered until more text arrives or Sarvam.RealtimeTTSPlayer.flush is called. Find more information in the documentation.
Parameters
Inherited Methods
addEventListener
Inherited from BasePlayer.
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
id
Inherited from BasePlayer.
Returns the player’s id.
pause
Inherited from BasePlayer.
Pauses playback. To continue the playback use the Player.resume method.
removeEventListener
Inherited from BasePlayer.
Removes a handler for the specified PlayerEvents event.
Parameters
resume
Inherited from BasePlayer.
Resumes playback after the Player.pause method is called.
sendMediaTo
Inherited from BasePlayer.
Starts sending media from the player to the media unit.
Parameters
stop
Inherited from BasePlayer.
Stops playback. The current player’s instance is destroyed.
stopMediaTo
Inherited from BasePlayer.
Stops sending media from the player to the media unit.
Parameters