Skip to content

Commit 14eb7ac

Browse files
authored
Add setOutputMedium (#8)
1 parent 59e46c6 commit 14eb7ac

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ Android client SDK for [Ultravox](https://ultravox.ai).
77
## Usage
88

99
```kotlin
10-
val sessionState = session.joinCall(joinText.text.toString())
11-
sessionState.listen("transcript") {
10+
session.listen("transcript") {
1211
run {
13-
val last = sessionState.lastTranscript
12+
val last = session.lastTranscript
1413
// Do stuff with the transcript
1514
}
1615
}
16+
session.joinCall(joinText.text.toString())
1717
```
1818

1919
See the included example app for a more complete example. To get a `joinUrl`, you'll want to
2020
integrate your server with the [Ultravox REST API](https://fixie-ai.github.io/ultradox/).
2121

22+
## Publishing
23+
24+
1. Bump the version in ultravox_client's build.gradle.kts
25+
2. Uncomment the "LocalForCentralUpload" maven repository block in the same gradle file
26+
3. Uncomment and properly populate the three signing-related values in gradle.properties
27+
4. Run publishToMaven
28+
5. Compress the output "ai" directory into a zip file
29+
6. Upload that zip to https://central.sonatype.com/publishing and work through the UI to publish

gradle.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
# The last 8 digits of your pub key id from gpg. Get with `gpg --list-keys`
25+
#signing.keyId=
26+
# The password for your keyring. DO NOT COMMIT
27+
#signing.password=
28+
# Path to your exported keyring from `gpg --keyring secring.gpg --export-secret-key $keyId_from_above > ~/tmp/secring.gpg`
29+
signing.secretKeyRingFile=/home/mike/tmp/secring.gpg

ultravox_client/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ publishing {
4949
register<MavenPublication>("release") {
5050
groupId = "ai.fixie"
5151
artifactId = "ultravox-client-sdk"
52-
version = "0.1.2"
52+
version = "0.1.4"
5353

5454
pom {
5555
name = "Ultravox Client"

ultravox_client/src/main/java/ai/ultravox/UltravoxSession.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ class UltravoxSession(
198198
disconnect()
199199
}
200200

201+
/**
202+
* Sets the agent's output medium. If the agent is currently speaking, this will take effect at
203+
* the end of the agent's utterance. Also see [speakerMuted].
204+
*/
205+
fun setOutputMedium(medium: Transcript.Medium) {
206+
if (!status.live) {
207+
throw RuntimeException("Cannot set output medium while not connected. Current status is $status.")
208+
}
209+
val message = JSONObject()
210+
message.put("type", "set_output_medium")
211+
message.put("medium", medium.name.lowercase())
212+
sendData(message)
213+
}
214+
201215
/** Sends a message via text. */
202216
fun sendText(text: String) {
203217
if (!status.live) {

0 commit comments

Comments
 (0)