Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AND-22] Expose Transcription APIs to Call Class #1234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
aleksandar-apostolov marked this conversation as resolved.
Show resolved Hide resolved
// 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.")
}
3 changes: 3 additions & 0 deletions stream-video-android-core/api/stream-video-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 migrate (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;
Expand Down Expand Up @@ -73,10 +74,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 takeScreenshot (Lio/getstream/video/android/core/model/VideoTrack;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ 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
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
Expand Down Expand Up @@ -1264,6 +1267,18 @@ public class Call(
return clientImpl.toggleAudioProcessing()
}

suspend fun startTranscription(): Result<StartTranscriptionResponse> {
return clientImpl.startTranscription(type, id)
}

suspend fun stopTranscription(): Result<StopTranscriptionResponse> {
return clientImpl.stopTranscription(type, id)
}

suspend fun listTranscription(): Result<ListTranscriptionsResponse> {
return clientImpl.listTranscription(type, id)
}

@InternalStreamVideoApi
public val debug = Debug(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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
Expand All @@ -115,7 +116,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
Expand Down Expand Up @@ -1092,6 +1096,25 @@ internal class StreamVideoClient internal constructor(
internal fun toggleAudioProcessing(): Boolean {
return peerConnectionFactory.toggleAudioProcessing()
}

suspend fun startTranscription(type: String, id: String, externalStorage: String? = null): Result<StartTranscriptionResponse> {
return apiCall {
val startTranscriptionRequest = StartTranscriptionRequest(externalStorage)
coordinatorConnectionModule.api.startTranscription(type, id, startTranscriptionRequest)
}
}

suspend fun stopTranscription(type: String, id: String): Result<StopTranscriptionResponse> {
return apiCall {
coordinatorConnectionModule.api.stopTranscription(type, id)
}
}

suspend fun listTranscription(type: String, id: String): Result<ListTranscriptionsResponse> {
return apiCall {
coordinatorConnectionModule.api.listTranscriptions(type, id)
}
}
}

/** Extension function that makes it easy to use on kotlin, but keeps Java usable as well */
Expand Down
Loading