Repository navigation
feat: add a LiveKit voice transport to the test app - #206
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add LiveKitTransport, a reference VoiceTransport on the LiveKit Android SDK that apps can copy, and pass one app-wide instance to every chat entry point in the test app. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The voice section of the implementation guide now covers adding LiveKit (and JitPack), the microphone permission, copying the reference transport, keeping one app-wide instance and passing it to every chat entry point (the same instance for chats that share a view model), and audio quality: echo cancellation, speaker output, interruptions and the device checks to repeat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
76d7593 to
d159abd
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/implementation-guide.md
Only leaving, a deleted room or a removed participant end the conversation normally, matching the iOS reference transport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ansport Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or good A permanent focus loss reports Failed instead of an audio interruption, since the audio will not come back and the chat has no unmute control. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rk loss Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d with a foreground service LiveKitTransport opts in to background conversations and runs a microphone foreground service from connect until the connection ends. The service's ongoing notification opens the app, and its End action or removing the app from the recent apps leaves the room and reports a normal end. The service reaches the transport through a callback it holds only while a conversation runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Declare the service and its permissions, keep LiveKit's FOREGROUND_SERVICE entry, copy the service with the transport, and update the phone call and device check notes. Background conversations now follow the audio notes so those stay with the walkthrough. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
State the Brand Concierge version voice needs, that voice must be enabled for the Brand Concierge by Adobe, and the current limitations: no auth token or XDM context, server-set language, English-only voice UI text, WebRTC network requirements and the Google Play Data safety disclosure. Clarify in the style guide that enableVoiceInput controls dictation only and which colors the voice conversation button uses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the long paragraph on what happens during a voice conversation with a short list of what the user sees and when the conversation ends. Leave the transport timing and interruption rules to the VoiceTransport API documentation and the Audio quality section, and drop the duplicated 60-minute and end-condition text. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the JitPack repository into its own settings.gradle.kts snippet ahead of the LiveKit dependency, with a callout naming the JitPack-only artifact and the Gradle error shown when the repository is missing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LiveKitTransport changed the microphone in a coroutine and only logged a failure, so Brand Concierge kept the conversation going while the microphone could be live during an interruption or muted while the chat shows Listening. A mute or unmute that throws or returns false now leaves the room and reports Failed, as VoiceTransport asks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/implementation-guide.md
Implement VoiceTransport.send by publishing the message to the room with reliable delivery on the given topic. The callback gets publishData's result, or the cancellation if the conversation ends first, so it always completes once. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/implementation-guide.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # Documentation/implementation-guide.md
# Conflicts: # Documentation/implementation-guide.md
The test app registers its LiveKit transport once with Concierge.setVoiceTransport in Application.onCreate, instead of passing it to every ConciergeChat and ConciergeChatView. The style guide says the voice button appears while a transport is registered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use one heading level for the voice steps, place Background conversations after the steps, and point to the manifest entries in step 2 instead of repeating them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rymorale
left a comment
There was a problem hiding this comment.
the test app updates LGTM with just a couple of nits to take a look at.
| callback.onComplete(error) | ||
| }.invokeOnCompletion { cause -> | ||
| // A send cancelled by [disconnect] still completes, with the cancellation. | ||
| if (cause != null) callback.onComplete(cause) |
There was a problem hiding this comment.
Nit: this can complete the callback twice if disconnect() cancels the job just after publishData finishes. The coroutine body calls onComplete, then invokeOnCompletion sees the cancellation and calls it again. The SDK guards against duplicate completions, so this isn't blocking, but the reference transport should follow the exactly-once contract. Can we use a single completion path or guard both calls with an AtomicBoolean?
There was a problem hiding this comment.
Good catch. Both paths now go through one AtomicBoolean guard, so the callback completes exactly once: from the coroutine if it finishes, otherwise with the cancellation. Fixed in 0e94c3a.
| * | ||
| * Copy this file and [VoiceForegroundService] into your app and add `io.livekit:livekit-android` to | ||
| * your app's dependencies. Create one instance with the application context and pass it to every | ||
| * `ConciergeChat(...)` call and `ConciergeChatView`. |
There was a problem hiding this comment.
Nit: this setup guidance is stale now that transport registration is global. Can we say to create one app-wide instance and register it with Concierge.setVoiceTransport in Application.onCreate(), rather than pass it to each chat? That would match the implementation guide and avoid sending people copying this file toward the removed chat parameters.
There was a problem hiding this comment.
Updated: it now says to create one instance for the life of the app and register it once with Concierge.setVoiceTransport, for example in Application.onCreate(), as the implementation guide does. Fixed in 35afe9e.
A send that disconnect() cancelled just after publishData returned completed the callback from the coroutine and again from invokeOnCompletion. Both paths now go through one guard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rymorale
left a comment
There was a problem hiding this comment.
the changes LGTM overall with just an implementation guide update needed.
|
|
||
| ### Limitations | ||
|
|
||
| - **No authentication token.** Brand Concierge doesn't send the token from `Concierge.setAuthTokenProvider` when it starts a voice conversation, so the voice agent works without it. Typed and dictated messages in the same chat still include it. |
There was a problem hiding this comment.
Could we update this limitation and the matching sentence in the Authentication section (line 176)? createVoiceBootstrapRequestBody() now includes authDataPart(), so the token from Concierge.setAuthTokenProvider is sent with the voice-start request. The remaining limitation is that the voice agent doesn't receive it yet, rather than that voice startup doesn't send it.
The voice bootstrap now sends the token from setAuthTokenProvider. The remaining limitation is that the voice agent doesn't use it yet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Android counterpart of adobe/aepsdk-concierge-ios#191. The test app now carries a reference
VoiceTransportbuilt on LiveKit. The same file replaces the voice plugin in the voice reference app (Adobe-AI-Core-Services/voice_demo-app-android#2).Description
LiveKitTransport.kt(test app): a completeVoiceTransporton the LiveKit Android SDK 2.29.1, meant to be copied into apps.connectgets its own room and coroutine scope, and a superseded room is released off the main thread.Disconnected; any other disconnect reason (includingROOM_CLOSED) or error reportsFailed, the same set as the iOS demo app's transport.Reconnecting, thenConnected. LiveKit 2.29.1 sends no room event for a quick resume, so a resume shows no spinner, and sendsDisconnectedif it gives up.AudioSwitchHandler. A permanent loss (AUDIOFOCUS_LOSS) leaves the room and reportsFailed, because the audio will not come back and the chat has no unmute control.send(data, topic, callback)(added in feat: hold voice conversations through an app-provided transport #205) withpublishDataandDataPublishReliability.RELIABLE, and calls the callback with the result. With no room it completes with an error, so Brand Concierge shows its send-failed message; if the conversation ends before the publish finishes, it completes with the cancellation.continuesInBackgroundtrue(see feat: hold voice conversations through an app-provided transport #205) and runs a microphone foreground service fromconnectuntil the connection ends, so a conversation keeps running with the screen locked or in another app.VoiceForegroundService.kt(test app): the foreground service, also meant to be copied. Its ongoing notification opens the app, and its End action or removing the app from recent apps leaves the room and reports a normal end. Without the notification permission it runs without the notification; the test app doesn't ask for it. The manifest declares it withforegroundServiceType="microphone"and theFOREGROUND_SERVICE,FOREGROUND_SERVICE_MICROPHONEandPOST_NOTIFICATIONSpermissions.Voice.transport, created inChatApp.onCreate) is registered withConcierge.setVoiceTransport(feat: hold voice conversations through an app-provided transport #205 section 7), so every chat entry point (MainScreen,LinkHandlingTesting, bothDataHandoffDemochats andXmlChatActivity) gets voice without passing it.io.livekit:livekit-android:2.29.1on the test app only. JitPack was already insettings.gradle.kts, and the test app already declaresRECORD_AUDIO.Concierge.setVoiceTransportat launch, background conversations with the foreground service (its manifest entries are in step 2), and audio quality: echo cancellation, speaker output, interruptions (including a permanent focus loss ending the conversation), and the device checks to repeat.setVoiceTransport(section 7): step 4 registers the transport instead of passing it to every entry point, and the style guide says the voice button appears while a transport is registered.sendmust use reliable delivery and call its callback once, and the chat notes say the thinking indicator shows until the reply starts, each reply's cards, sources and suggestions appear when it finishes, and suggestion taps go to the agent. The limitations say a conversation uses the XDM context captured when it starts (feat: hold voice conversations through an app-provided transport #205 section 5).How Has This Been Tested?
./gradlew :testapp:assembleDebugbuilds (after the latest changes,:testapp:compileDebugKotlinandmake lintpass, and:testapp:installDebugruns on a Galaxy S25).End to end on a Galaxy S25 (Android 17) with a temporary instrumentation test (not committed), against the Stage voice-enabled configuration: open the chat, start voice, connect and subscribe to the agent's audio track, receive data-channel messages, hold 10 s, stop cleanly.
A phone call during a session (Galaxy S25): the conversation continues while the phone rings (Android doesn't signal the ring to the app). Answering moves the app to the background; with the background opt-in the conversation continues, muted until the call ends (checked again while locked). The guide describes this.
Wi-Fi off during a session (Galaxy S25, Stage, which cellular can't reach): the spinner appears about 30 seconds after Wi-Fi goes off, and the conversation ends with an error 30 seconds later. LiveKit first waits 20 seconds for its server check to time out, then tries a quick resume for 10 seconds, which sends no event; the spinner appears with the full reconnect. iOS shows it after about 10 seconds because the Swift SDK reports quick reconnects too. The transport doc and the guide describe this.
Speaker and headphones (Galaxy S25): no echo on the speaker, and switching wired and Bluetooth headphones mid-session moves the audio as expected (Bluetooth, then the speaker when it disconnects, then another Bluetooth headset when it connects).
Background on a Galaxy S25 (Android 17) (Stage config and a 3-minute cap in a local build only): screen locked, another app in front, locking while connecting, a product card while locked, an incoming call while locked, Wi-Fi ↔ cellular, Bluetooth, removing the app from recent apps, the notification and its End action, notifications denied, the cap, and 60 s of silence in the background. With feat: hold voice conversations through an app-provided transport #205's scroll fix, the voice reply stays on screen as it arrives.
On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's voice turns (Stage config in a local build only): a product card arriving while the screen is locked renders with the reply after unlocking, and a suggestion tapped during voice reaches the agent through
send(data, topic, callback)and gets a voice reply. Taps while connecting, while the user speaks or before the reply starts are ignored, and after voice ends a tap streams as typed chat.On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's held XDM context (temporary test code, not committed): the bootstrap sends the held context and voice connects. After the context changes during voice, a suggestion tapped in that conversation is tracked with the bootstrap's context, and the next bootstrap and a typed send use the new one.
On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's thinking indicator (Stage config in a local build only): the indicator shows after speaking and after a suggestion tap, turns into the reply when its text starts, and is removed when voice stops while it shows.
Types of changes
Checklist: