Skip to content

Commit a1c5800

Browse files
authored
Add setOutputMedium (#13)
1 parent 817318f commit a1c5800

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ultravox-client",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"private": false,
55
"files": [
66
"dist"

src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ export class UltravoxSession extends EventTarget {
195195
await this.disconnect();
196196
}
197197

198+
/**
199+
* Sets the agent's output medium. If the agent is currently speaking, this will take effect at
200+
* the end of the agent's utterance. Also see muteSpeaker and unmuteSpeaker below.
201+
*/
202+
setOutputMedium(medium: Medium) {
203+
if (!UltravoxSession.CONNECTED_STATUSES.has(this._status)) {
204+
throw new Error(`Cannot set output medium while not connected. Current status is ${this._status}.`);
205+
}
206+
this.sendData({ type: 'set_output_medium', medium });
207+
}
208+
198209
/** Sends a message via text. */
199210
sendText(text: string) {
200211
if (!UltravoxSession.CONNECTED_STATUSES.has(this._status)) {

0 commit comments

Comments
 (0)