From 769f98ac70993efc9b4e8de01bcfd2ac4b8f7bc3 Mon Sep 17 00:00:00 2001 From: rahul_lohra Date: Mon, 25 Nov 2024 17:50:50 +0530 Subject: [PATCH 1/4] Expose Transcription APIs to Call Class This commit introduces the following APIs to the Call class for managing transcription functionalities: startTranscription: Initiates the transcription process. stopTranscription: Terminates the ongoing transcription process. listTranscription: Retrieves a list of available transcriptions. These APIs are now accessible to enable seamless integration of transcription features within the Call class. --- build.gradle.kts | 16 +++++++++---- .../api/stream-video-android-core.api | 3 +++ .../io/getstream/video/android/core/Call.kt | 15 ++++++++++++ .../video/android/core/StreamVideoImpl.kt | 23 +++++++++++++++++++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 08f5ebcf6c..0b0cf59d4f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -63,9 +63,15 @@ apply(from = "${rootDir}/scripts/publish-root.gradle") //} afterEvaluate { - println("Running Add Pre Commit Git Hook Script on Build") - exec { - commandLine("cp", "./scripts/git-hooks/pre-push", "./.git/hooks") - } - println("Added pre-push Git Hook Script.") + println("Running Add Pre Commit Git Hook Script on Build") + exec { + if (System.getProperty("os.name").toLowerCase().contains("win")) { + // Windows-specific command + commandLine("cmd", "/c", "copy", ".\\scripts\\git-hooks\\pre-push", ".\\.git\\hooks") + } else { + // Unix-based systems + commandLine("cp", "./scripts/git-hooks/pre-push", "./.git/hooks") + } + } + println("Added pre-push Git Hook Script.") } \ No newline at end of file diff --git a/stream-video-android-core/api/stream-video-android-core.api b/stream-video-android-core/api/stream-video-android-core.api index 3659f4d257..ca4bf15e48 100644 --- a/stream-video-android-core/api/stream-video-android-core.api +++ b/stream-video-android-core/api/stream-video-android-core.api @@ -41,6 +41,7 @@ public final class io/getstream/video/android/core/Call { public final fun leave ()V public final fun listRecordings (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun listRecordings$default (Lio/getstream/video/android/core/Call;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public final fun listTranscription (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun muteAllUsers (ZZZLkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun muteAllUsers$default (Lio/getstream/video/android/core/Call;ZZZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public final fun muteUser (Ljava/lang/String;ZZZLkotlin/coroutines/Continuation;)Ljava/lang/Object; @@ -69,10 +70,12 @@ public final class io/getstream/video/android/core/Call { public final fun startHLS (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun startRecording (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun startScreenSharing (Landroid/content/Intent;)V + public final fun startTranscription (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun stopHLS (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun stopLive (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun stopRecording (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun stopScreenSharing ()V + public final fun stopTranscription (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public final fun subscribe (Lio/getstream/video/android/core/events/VideoEventListener;)Lio/getstream/video/android/core/EventSubscription; public final fun subscribeFor ([Ljava/lang/Class;Lio/getstream/video/android/core/events/VideoEventListener;)Lio/getstream/video/android/core/EventSubscription; public final fun switchSfu (Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt index 243e18b8a6..3be01f3f6b 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt @@ -67,6 +67,7 @@ import org.openapitools.client.models.GetOrCreateCallResponse import org.openapitools.client.models.GoLiveResponse import org.openapitools.client.models.JoinCallResponse import org.openapitools.client.models.ListRecordingsResponse +import org.openapitools.client.models.ListTranscriptionsResponse import org.openapitools.client.models.MemberRequest import org.openapitools.client.models.MuteUsersResponse import org.openapitools.client.models.OwnCapability @@ -74,7 +75,9 @@ import org.openapitools.client.models.PinResponse import org.openapitools.client.models.RejectCallResponse import org.openapitools.client.models.SendCallEventResponse import org.openapitools.client.models.SendReactionResponse +import org.openapitools.client.models.StartTranscriptionResponse import org.openapitools.client.models.StopLiveResponse +import org.openapitools.client.models.StopTranscriptionResponse import org.openapitools.client.models.UnpinResponse import org.openapitools.client.models.UpdateCallMembersRequest import org.openapitools.client.models.UpdateCallMembersResponse @@ -1119,6 +1122,18 @@ public class Call( return clientImpl.toggleAudioProcessing() } + suspend fun startTranscription(): Result { + return clientImpl.startTranscription(type, id) + } + + suspend fun stopTranscription(): Result { + return clientImpl.stopTranscription(type, id) + } + + suspend fun listTranscription(): Result { + return clientImpl.listTranscription(type, id) + } + @InternalStreamVideoApi public val debug = Debug(this) diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoImpl.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoImpl.kt index ddbadd449a..b9de28e91a 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoImpl.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoImpl.kt @@ -101,6 +101,7 @@ import org.openapitools.client.models.GoLiveResponse import org.openapitools.client.models.JoinCallRequest import org.openapitools.client.models.JoinCallResponse import org.openapitools.client.models.ListRecordingsResponse +import org.openapitools.client.models.ListTranscriptionsResponse import org.openapitools.client.models.MemberRequest import org.openapitools.client.models.MuteUsersResponse import org.openapitools.client.models.PinRequest @@ -116,7 +117,10 @@ import org.openapitools.client.models.SendReactionRequest import org.openapitools.client.models.SendReactionResponse import org.openapitools.client.models.StartHLSBroadcastingResponse import org.openapitools.client.models.StartRecordingRequest +import org.openapitools.client.models.StartTranscriptionRequest +import org.openapitools.client.models.StartTranscriptionResponse import org.openapitools.client.models.StopLiveResponse +import org.openapitools.client.models.StopTranscriptionResponse import org.openapitools.client.models.UnblockUserRequest import org.openapitools.client.models.UnpinRequest import org.openapitools.client.models.UpdateCallMembersRequest @@ -1122,6 +1126,25 @@ internal class StreamVideoImpl internal constructor( internal fun toggleAudioProcessing(): Boolean { return peerConnectionFactory.toggleAudioProcessing() } + + suspend fun startTranscription(type: String, id: String, externalStorage: String? = null): Result { + return wrapAPICall { + val startTranscriptionRequest = StartTranscriptionRequest(externalStorage) + connectionModule.api.startTranscription(type, id, startTranscriptionRequest) + } + } + + suspend fun stopTranscription(type: String, id: String): Result { + return wrapAPICall { + connectionModule.api.stopTranscription(type, id) + } + } + + suspend fun listTranscription(type: String, id: String): Result { + return wrapAPICall { + connectionModule.api.listTranscriptions(type, id) + } + } } /** Extension function that makes it easy to use on kotlin, but keeps Java usable as well */ From 0408fe776816df1891cf2455fc849c2284a1ec32 Mon Sep 17 00:00:00 2001 From: rahul_lohra Date: Tue, 26 Nov 2024 17:43:15 +0530 Subject: [PATCH 2/4] Fix variable name mistake --- .../io/getstream/video/android/core/StreamVideoClient.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt index 0ef6d9b5ee..593f752630 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt @@ -1075,19 +1075,19 @@ internal class StreamVideoClient internal constructor( suspend fun startTranscription(type: String, id: String, externalStorage: String? = null): Result { return wrapAPICall { val startTranscriptionRequest = StartTranscriptionRequest(externalStorage) - connectionModule.api.startTranscription(type, id, startTranscriptionRequest) + coordinatorConnectionModule.api.startTranscription(type, id, startTranscriptionRequest) } } suspend fun stopTranscription(type: String, id: String): Result { return wrapAPICall { - connectionModule.api.stopTranscription(type, id) + coordinatorConnectionModule.api.stopTranscription(type, id) } } suspend fun listTranscription(type: String, id: String): Result { return wrapAPICall { - connectionModule.api.listTranscriptions(type, id) + coordinatorConnectionModule.api.listTranscriptions(type, id) } } } From 8d1f419ea606027352af8c864b91ba3d90163acd Mon Sep 17 00:00:00 2001 From: rahullohra Date: Tue, 3 Dec 2024 18:25:17 +0530 Subject: [PATCH 3/4] Update transcribing flow based on websocket events --- .../io/getstream/video/android/core/CallState.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt index 1adac85b87..b3a62edf7c 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt @@ -94,6 +94,9 @@ import org.openapitools.client.models.CallSessionResponse import org.openapitools.client.models.CallSessionStartedEvent import org.openapitools.client.models.CallSettingsResponse import org.openapitools.client.models.CallStateResponseFields +import org.openapitools.client.models.CallTranscriptionFailedEvent +import org.openapitools.client.models.CallTranscriptionStartedEvent +import org.openapitools.client.models.CallTranscriptionStoppedEvent import org.openapitools.client.models.CallUpdatedEvent import org.openapitools.client.models.ConnectedEvent import org.openapitools.client.models.CustomVideoEvent @@ -932,6 +935,16 @@ public class CallState( updateParticipantCounts(session = session.value) updateRingingState() } + + is CallTranscriptionStartedEvent -> { + _transcribing.value = true + } + is CallTranscriptionStoppedEvent -> { + _transcribing.value = false + } + is CallTranscriptionFailedEvent -> { + _transcribing.value = false + } } } From 09a756e2215c9c07db135afdbf032908d6c3bcf5 Mon Sep 17 00:00:00 2001 From: rahullohra Date: Tue, 3 Dec 2024 18:50:40 +0530 Subject: [PATCH 4/4] Resolve merge conflict --- .../io/getstream/video/android/core/StreamVideoClient.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt index bbf6db6a99..8c0e66eae5 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt @@ -1098,20 +1098,20 @@ internal class StreamVideoClient internal constructor( } suspend fun startTranscription(type: String, id: String, externalStorage: String? = null): Result { - return wrapAPICall { + return apiCall { val startTranscriptionRequest = StartTranscriptionRequest(externalStorage) coordinatorConnectionModule.api.startTranscription(type, id, startTranscriptionRequest) } } suspend fun stopTranscription(type: String, id: String): Result { - return wrapAPICall { + return apiCall { coordinatorConnectionModule.api.stopTranscription(type, id) } } suspend fun listTranscription(type: String, id: String): Result { - return wrapAPICall { + return apiCall { coordinatorConnectionModule.api.listTranscriptions(type, id) } }