Skip to content

Commit

Permalink
Add setOutputMedium (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdepinet authored Oct 10, 2024
1 parent 817318f commit a1c5800
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ultravox-client",
"version": "0.3.0",
"version": "0.3.1",
"private": false,
"files": [
"dist"
Expand Down
11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ export class UltravoxSession extends EventTarget {
await this.disconnect();
}

/**
* Sets the agent's output medium. If the agent is currently speaking, this will take effect at
* the end of the agent's utterance. Also see muteSpeaker and unmuteSpeaker below.
*/
setOutputMedium(medium: Medium) {
if (!UltravoxSession.CONNECTED_STATUSES.has(this._status)) {
throw new Error(`Cannot set output medium while not connected. Current status is ${this._status}.`);
}
this.sendData({ type: 'set_output_medium', medium });
}

/** Sends a message via text. */
sendText(text: string) {
if (!UltravoxSession.CONNECTED_STATUSES.has(this._status)) {
Expand Down

0 comments on commit a1c5800

Please sign in to comment.