alexeyvasilyev / rtsp-client-android

Lightweight low-latency RTSP client library for Android
Apache License 2.0
248 stars 68 forks source link

Failed to start video decoder In Jetpack Compose #82

Closed jvasanthan closed 2 months ago

jvasanthan commented 2 months ago

I am using RtspSurfaceView in jetpack compose like this

DisposableEffect(Unit) {
    onDispose {
        // Stop the video when the composable is disposed
        rtspSurfaceView?.stop()
    }
}
AndroidView(
    modifier = Modifier
        .fillMaxSize()
        .aspectRatio(16 / 9f),
    factory = { context ->
        RtspSurfaceView(context).apply {
            init(uri, username, password)
            start(requestVideo = true, requestAudio = false)
            setStatusListener(rtspStatusListener)
            debug = true
            rtspSurfaceView = this
        }
    }
)

I get "Failed to start HARDWARE video decoder (The surface has been released)" & "Failed to start video software decoder. Exiting..." errors when I close and reopen clients multiple times.

How can I get it work in Jetpack Compose

alexeyvasilyev commented 2 months ago

Try to use RtspImageView instead.