From 73ff1f5de06d9cf99ab22e15bd627363fbeab614 Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Thu, 8 Feb 2024 09:25:26 +0100 Subject: [PATCH] chore(android): upgrade StreamPack to 2.6.0 --- android/build.gradle | 4 ++-- .../livestream/FlutterLiveStreamView.kt | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 9f4ab5e..8c1a2b4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ version '1.0-SNAPSHOT' buildscript { ext { kotlin_version = '1.9.22' - streamPackVersion = '2.5.2' + streamPackVersion = '2.6.0' } repositories { google() @@ -54,7 +54,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' implementation 'androidx.appcompat:appcompat:1.6.1' implementation "io.github.thibaultbee:streampack:$streamPackVersion" diff --git a/android/src/main/kotlin/video/api/flutter/livestream/FlutterLiveStreamView.kt b/android/src/main/kotlin/video/api/flutter/livestream/FlutterLiveStreamView.kt index 9bd9c98..62d3f2f 100644 --- a/android/src/main/kotlin/video/api/flutter/livestream/FlutterLiveStreamView.kt +++ b/android/src/main/kotlin/video/api/flutter/livestream/FlutterLiveStreamView.kt @@ -11,9 +11,9 @@ import io.github.thibaultbee.streampack.error.StreamPackError import io.github.thibaultbee.streampack.ext.rtmp.streamers.CameraRtmpLiveStreamer import io.github.thibaultbee.streampack.listeners.OnConnectionListener import io.github.thibaultbee.streampack.listeners.OnErrorListener -import io.github.thibaultbee.streampack.utils.getBackCameraList -import io.github.thibaultbee.streampack.utils.getExternalCameraList -import io.github.thibaultbee.streampack.utils.getFrontCameraList +import io.github.thibaultbee.streampack.utils.backCameraList +import io.github.thibaultbee.streampack.utils.externalCameraList +import io.github.thibaultbee.streampack.utils.frontCameraList import io.github.thibaultbee.streampack.utils.isBackCamera import io.github.thibaultbee.streampack.utils.isExternalCamera import io.github.thibaultbee.streampack.utils.isFrontCamera @@ -162,16 +162,16 @@ class FlutterLiveStreamView( fun setCameraPosition(position: String, onSuccess: () -> Unit, onError: (Exception) -> Unit) { val cameraList = when (position) { - "front" -> context.getFrontCameraList() - "back" -> context.getBackCameraList() - "other" -> context.getExternalCameraList() + "front" -> context.frontCameraList + "back" -> context.backCameraList + "other" -> context.externalCameraList else -> throw IllegalArgumentException("Invalid camera position: $position") } setCamera(cameraList.first(), onSuccess, onError) } fun dispose() { - streamer.stopStream() + stopStream() streamer.stopPreview() flutterTexture.release() } @@ -192,7 +192,9 @@ class FlutterLiveStreamView( fun stopStream() { val isConnected = streamer.isConnected - streamer.stopStream() + runBlocking { + streamer.stopStream() + } streamer.disconnect() if (isConnected) { onDisconnected()