Skip to content

Commit

Permalink
chore(android): upgrade StreamPack to 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Feb 8, 2024
1 parent 3eb3a20 commit 73ff1f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
Expand All @@ -192,7 +192,9 @@ class FlutterLiveStreamView(

fun stopStream() {
val isConnected = streamer.isConnected
streamer.stopStream()
runBlocking {
streamer.stopStream()
}
streamer.disconnect()
if (isConnected) {
onDisconnected()
Expand Down

0 comments on commit 73ff1f5

Please sign in to comment.