You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to make a POC using your library but I have encountered a hard crash whenever the user presses the power button of the device (Samsung XCover 5 running Android 13) whilst streaming a video. This happens continuesly so it's easy to reproduce. I also was able to reproduce this on the Android Emulator running A13.
I also cloned the project, build and installed the app and I am still getting the same crash and log output !
It seems like network connectivity is happening on the main Thread, which StrictMode doesn't like ?
The error which is being thrown is the following :
--------- beginning of crash
2023-04-20 10:25:13.504 16791-16791/com.company.videopoc E/AndroidRuntime: FATAL EXCEPTION: main
Process:com.company.videopoc, PID: 16791
java.lang.RuntimeException: Unable to pause activity {com.company.videopoc/com.company.videopoc.ui.ShowVideoActivity}: android.os.NetworkOnMainThreadException
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5704)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5655)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5607)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1667)
at com.android.org.conscrypt.Platform.blockGuardOnNetwork(Platform.java:431)
at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:836)
at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:824)
at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:797)
at com.android.okhttp.okio.Okio$2.read(Okio.java:138)
at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:213)
at com.android.okhttp.okio.RealBufferedSource.request(RealBufferedSource.java:72)
at com.android.okhttp.okio.RealBufferedSource.require(RealBufferedSource.java:65)
at com.android.okhttp.okio.RealBufferedSource.readHexadecimalUnsignedLong(RealBufferedSource.java:271)
at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.readChunkSize(Http1xStream.java:456)
at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:437)
at com.android.okhttp.internal.Util.skipAll(Util.java:165)
at com.android.okhttp.internal.Util.discard(Util.java:147)
at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.close(Http1xStream.java:474)
at com.android.okhttp.okio.RealBufferedSource.close(RealBufferedSource.java:397)
at com.android.okhttp.okio.RealBufferedSource$1.close(RealBufferedSource.java:385)
at com.google.firebase.perf.network.InstrHttpInputStream.close(InstrHttpInputStream.java:67)
at java.io.BufferedInputStream.close(BufferedInputStream.java:485)
at java.io.FilterInputStream.close(FilterInputStream.java:180)
at com.github.niqdev.mjpeg.MjpegViewDefault._stopPlayback(MjpegViewDefault.java:143)
at com.github.niqdev.mjpeg.MjpegViewDefault.stopPlayback(MjpegViewDefault.java:283)
at com.github.niqdev.mjpeg.MjpegSurfaceView.stopPlayback(MjpegSurfaceView.java:136)
at com.company.videopoc.ui.ShowVideoActivity.onPause(ShowVideoActivity.kt:206)
at android.app.Activity.performPause(Activity.java:8765)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1585)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5694)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5655)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5607)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
The text was updated successfully, but these errors were encountered:
tiger79
changed the title
Unable to pause activity when power button is pressed
Library/acitvity crashes when power button is pressed
Apr 20, 2023
Hi @tiger79 thanks for reporting the issue, I'm not actively maintaining the project but if you think this is a bug, feel free to open a pr to fix it and I'll be happy to merge it! Thanks!
Hi,
I am trying to make a POC using your library but I have encountered a hard crash whenever the user presses the power button of the device (Samsung XCover 5 running Android 13) whilst streaming a video. This happens continuesly so it's easy to reproduce. I also was able to reproduce this on the Android Emulator running A13.
I also cloned the project, build and installed the app and I am still getting the same crash and log output !
It seems like network connectivity is happening on the main Thread, which StrictMode doesn't like ?
The error which is being thrown is the following :
The text was updated successfully, but these errors were encountered: