Skip to content

Commit

Permalink
Bot speaking callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-daily committed Aug 19, 2024
1 parent 9a095f2 commit 8cb3ffe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ open class VoiceClient(
callbacks.onUserStoppedSpeaking()
}

MsgServerToClient.Type.BotStartedSpeaking -> {
callbacks.onBotStartedSpeaking()
}

MsgServerToClient.Type.BotStoppedSpeaking -> {
callbacks.onBotStoppedSpeaking()
}

else -> {

var match = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8cb3ffe

Please sign in to comment.