Error while starting streamer
io.github.thibaultbee.streampack.error.StreamPackError: java.lang.IllegalStateException: Must register a callback before starting capture, to manage resources in response to MediaProjection states.
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.startStream$suspendImpl(BaseStreamer.kt:308)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer$startStream$1.invokeSuspend(Unknown Source:14)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity.configureAndStart(MainActivity.kt:217)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity.access$configureAndStart(MainActivity.kt:54)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity$getContent$1$3.invoke(MainActivity.kt:148)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity$getContent$1$3.invoke(MainActivity.kt:139)
at io.github.thibaultbee.streampack.ext.rtmp.services.ScreenRecorderRtmpLiveService$Companion$launch$1.invoke(ScreenRecorderRtmpLiveService.kt:67)
at io.github.thibaultbee.streampack.ext.rtmp.services.ScreenRecorderRtmpLiveService$Companion$launch$1.invoke(ScreenRecorderRtmpLiveService.kt:63)
at io.github.thibaultbee.streampack.streamers.services.BaseScreenRecorderService$Companion$launch$connection$1.onServiceConnected(BaseScreenRecorderService.kt:303)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2198)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2231)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.IllegalStateException: Must register a callback before starting capture, to manage resources in response to MediaProjection states.
at android.media.projection.MediaProjection.createVirtualDisplay(MediaProjection.java:206)
at io.github.thibaultbee.streampack.internal.sources.screen.ScreenSource.startStream(ScreenSource.kt:116)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.startStream$suspendImpl(BaseStreamer.kt:304)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer$startStream$1.invokeSuspend(Unknown Source:14)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity.configureAndStart(MainActivity.kt:217)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity.access$configureAndStart(MainActivity.kt:54)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity$getContent$1$3.invoke(MainActivity.kt:148)
at io.github.thibaultbee.streampack.screenrecorder.MainActivity$getContent$1$3.invoke(MainActivity.kt:139)
at io.github.thibaultbee.streampack.ext.rtmp.services.ScreenRecorderRtmpLiveService$Companion$launch$1.invoke(ScreenRecorderRtmpLiveService.kt:67)
at io.github.thibaultbee.streampack.ext.rtmp.services.ScreenRecorderRtmpLiveService$Companion$launch$1.invoke(ScreenRecorderRtmpLiveService.kt:63)
at io.github.thibaultbee.streampack.streamers.services.BaseScreenRecorderService$Companion$launch$connection$1.onServiceConnected(BaseScreenRecorderService.kt:303)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2198)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2231)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Version
2.6.0
Environment that reproduces the issue
Real device: Samsung S21FE Emulated device: Pixel 5 - API 34
RTMP/SRT/... Server
RTMP screen streamer
Audio configuration
No response
Video configuration
No response
Is it reproducible in the demos application?
Yes
Reproduction steps
Setup RTMP server, press 'Record screen' - after allowing screen recording app fails
Expected result
Stream screen to RTMP server
Actual result
The app reports the following error:![Screenshot_20240628_124309_Screen Recorder](https://github.com/ThibaultBee/StreamPack/assets/21056975/4498e7e4-90d2-4d89-98f1-1f936e06457f)
Additional context
No response
Relevant logs output