From 8cb3ffe6217824b1e055816bae3a7903d0ca982c Mon Sep 17 00:00:00 2001 From: marcus-daily <111281783+marcus-daily@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:36:11 +0100 Subject: [PATCH] Bot speaking callbacks --- .github/workflows/ci.yaml | 2 +- .../src/main/java/ai/rtvi/client/VoiceClient.kt | 8 ++++++++ .../main/java/ai/rtvi/client/VoiceEventCallbacks.kt | 12 ++++++------ .../ai/rtvi/client/transport/MsgServerToClient.kt | 2 ++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 908019b..c9019c9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,5 +45,5 @@ jobs: - name: Upload Maven repo uses: actions/upload-artifact@v4 with: - name: Release Library Repo + name: RTVIClientAndroid-Repo path: build/RTVILocalRepo diff --git a/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceClient.kt b/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceClient.kt index 6d03e47..37dac1a 100644 --- a/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceClient.kt +++ b/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceClient.kt @@ -166,6 +166,14 @@ open class VoiceClient( callbacks.onUserStoppedSpeaking() } + MsgServerToClient.Type.BotStartedSpeaking -> { + callbacks.onBotStartedSpeaking() + } + + MsgServerToClient.Type.BotStoppedSpeaking -> { + callbacks.onBotStoppedSpeaking() + } + else -> { var match = false diff --git a/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceEventCallbacks.kt b/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceEventCallbacks.kt index 50aaf2a..2554ae4 100644 --- a/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceEventCallbacks.kt +++ b/rtvi-client-android/src/main/java/ai/rtvi/client/VoiceEventCallbacks.kt @@ -85,12 +85,12 @@ abstract class VoiceEventCallbacks { /** * Invoked when the bot starts talking. */ - open fun onBotStartedSpeaking(participant: Participant) {} + open fun onBotStartedSpeaking() {} /** * Invoked when the bot stops talking. */ - open fun onBotStoppedSpeaking(participant: Participant) {} + open fun onBotStoppedSpeaking() {} /** * Invoked when the local user starts talking. @@ -189,12 +189,12 @@ internal class CallbackInterceptor(vararg listeners: VoiceEventCallbacks): Voice callbacks.forEach { it.onRemoteAudioLevel(level, participant) } } - override fun onBotStartedSpeaking(participant: Participant) { - callbacks.forEach { it.onBotStartedSpeaking(participant) } + override fun onBotStartedSpeaking() { + callbacks.forEach { it.onBotStartedSpeaking() } } - override fun onBotStoppedSpeaking(participant: Participant) { - callbacks.forEach { it.onBotStoppedSpeaking(participant) } + override fun onBotStoppedSpeaking() { + callbacks.forEach { it.onBotStoppedSpeaking() } } override fun onUserStartedSpeaking() { diff --git a/rtvi-client-android/src/main/java/ai/rtvi/client/transport/MsgServerToClient.kt b/rtvi-client-android/src/main/java/ai/rtvi/client/transport/MsgServerToClient.kt index 65dbc9e..2d4dd76 100644 --- a/rtvi-client-android/src/main/java/ai/rtvi/client/transport/MsgServerToClient.kt +++ b/rtvi-client-android/src/main/java/ai/rtvi/client/transport/MsgServerToClient.kt @@ -30,6 +30,8 @@ data class MsgServerToClient( const val BotTranscription = "tts-text" const val UserStartedSpeaking = "user-started-speaking" const val UserStoppedSpeaking = "user-stopped-speaking" + const val BotStartedSpeaking = "bot-started-speaking" + const val BotStoppedSpeaking = "bot-stopped-speaking" } object Data {