diff --git a/README.md b/README.md index cf411ac..1872754 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This Android library exposes the `DailyVoiceClient` class, to connect to a Daily Add the following dependency to your `build.gradle` file: ``` -implementation "ai.rtvi:rtvi-client-android-daily:0.1.1" +implementation "ai.rtvi:rtvi-client-android-daily:0.1.2" ``` Instantiate from your code: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2609865..db99b4d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ kotlinxSerializationJson = "1.7.1" kotlinxSerializationPlugin = "2.0.0" dokka = "1.9.20" androidxTest = "1.6.1" -rtviClient = "0.1.0" +rtviClient = "0.1.1" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } diff --git a/rtvi-client-android-daily/build.gradle.kts b/rtvi-client-android-daily/build.gradle.kts index d5aa36f..7a636f7 100644 --- a/rtvi-client-android-daily/build.gradle.kts +++ b/rtvi-client-android-daily/build.gradle.kts @@ -66,7 +66,7 @@ publishing { register("release") { groupId = "ai.rtvi" artifactId = "client-daily" - version = "0.1.1" + version = "0.1.2" pom { name.set("RTVI Client Daily Transport") diff --git a/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/AudioLevelProcessor.kt b/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/AudioLevelProcessor.kt deleted file mode 100644 index e5b9990..0000000 --- a/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/AudioLevelProcessor.kt +++ /dev/null @@ -1,38 +0,0 @@ -package ai.rtvi.client.daily - -import ai.rtvi.client.utils.ThreadRef - -internal class AudioLevelProcessor( - private val thread: ThreadRef, - private val onIsSpeaking: (Boolean) -> Unit, - private val threshold: Float = 0.05f, - private val silenceDelayMs: Long = 750, -) { - private var speaking = false - - private val silenceAction = Runnable { - speaking = false - silencePending = null - onIsSpeaking(false) - } - - private var silencePending: Runnable? = null - - fun onLevelChanged(level: Float) { - thread.assertCurrent() - - if (level > threshold) { - if (silencePending != null) { - thread.handler.removeCallbacks(silenceAction) - silencePending = null - } - if (!speaking) { - speaking = true; - onIsSpeaking(true) - } - } else if (speaking && silencePending == null) { - silencePending = silenceAction - thread.handler.postDelayed(silenceAction, silenceDelayMs) - } - } -} \ No newline at end of file diff --git a/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/DailyTransport.kt b/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/DailyTransport.kt index 5957486..04d078b 100644 --- a/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/DailyTransport.kt +++ b/rtvi-client-android-daily/src/main/java/ai/rtvi/client/daily/DailyTransport.kt @@ -65,21 +65,6 @@ class DailyTransport( val participants = mutableMapOf() var botUser: Participant? = null - private val audioLevelProcessorBot = AudioLevelProcessor( - thread = thread, - onIsSpeaking = { - val bot = botUser - - if (bot != null) { - if (it) { - transportContext.callbacks.onBotStartedSpeaking(bot) - } else { - transportContext.callbacks.onBotStoppedSpeaking(bot) - } - } - } - ) - override fun onLocalAudioLevel(audioLevel: Float) { transportContext.callbacks.onUserAudioLevel(audioLevel) } @@ -91,11 +76,6 @@ class DailyTransport( val participant = participants[rtviId] if (participant != null) { - - if (botUser?.id == rtviId) { - audioLevelProcessorBot.onLevelChanged(level) - } - transportContext.callbacks.onRemoteAudioLevel( level = level, participant = participant