Closed luckkmaxx closed 6 months ago
When I get back into the app I get crashes like this
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3876)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4018)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2474)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.app.ActivityThread.main(ActivityThread.java:8427)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Caused by: org.chromium.base.JniException: lateinit property exoPlayer has not been initialized
at com.github.libretube.ui.fragments.PlayerFragment.onDestroy(SourceFile:148)
at androidx.fragment.app.Fragment.performDestroy(SourceFile:20)
at androidx.fragment.app.FragmentStateManager.destroy(SourceFile:125)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:370)
at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:1574)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82)
at androidx.fragment.app.FragmentManager.execSingleAction(SourceFile:32)
at com.github.libretube.helpers.NavigationHelper.navigateVideo$default(SourceFile:171)
at com.github.libretube.ui.activities.MainActivity.loadIntentData(SourceFile:204)
at com.github.libretube.ui.activities.MainActivity.onCreate(SourceFile:866)
at android.app.Activity.performCreate(Activity.java:8422)
at android.app.Activity.performCreate(Activity.java:8395)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3849)
... 12 more
When I get back into the app I get crashes like this
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3876) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4018) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2474) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:351) at android.app.ActivityThread.main(ActivityThread.java:8427) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013) Caused by: org.chromium.base.JniException: lateinit property exoPlayer has not been initialized at com.github.libretube.ui.fragments.PlayerFragment.onDestroy(SourceFile:148) at androidx.fragment.app.Fragment.performDestroy(SourceFile:20) at androidx.fragment.app.FragmentStateManager.destroy(SourceFile:125) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(SourceFile:370) at androidx.fragment.app.FragmentManager.executeOpsTogether(SourceFile:1574) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(SourceFile:82) at androidx.fragment.app.FragmentManager.execSingleAction(SourceFile:32) at com.github.libretube.helpers.NavigationHelper.navigateVideo$default(SourceFile:171) at com.github.libretube.ui.activities.MainActivity.loadIntentData(SourceFile:204) at com.github.libretube.ui.activities.MainActivity.onCreate(SourceFile:866) at android.app.Activity.performCreate(Activity.java:8422) at android.app.Activity.performCreate(Activity.java:8395) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3849) ... 12 more
I got errors sometimes but cant reproduce it always, so didnt posted any log here
This sounds like it is the same issue as this: #3187
Is it possible, that onResume triggers recreation of the player with the last video, and then starting to play the video, as if the user clicked on one?
Further investigation leads me to the following assumption:
Android does something to libretube, which results in the app not beeing "fully" recreated during the next start. It keeps the backstack and the normal livecycle, so it seems to be continuously alive, but it was infact discarded at some point, in some way.
What i observed was that onViewCreated
from the PlayerFragment
was called, and that function calls playVideo()
So the auto-play is somewhat intended, though i think the livecycle behaves somewhat weirdly. I dont know if this is device/os-specific, but i am using grapheneOS.
I will remove the playVideo-call and report if that fixes it for me, aswell as any side-effects.
It seems the actual culprit is this:
setting this to false fixed the autoplay for me. The downside is that videos only start playing after manually pressing the play-button, but i have not really looked into writing a workaround for that.
Bit late but this also happened to me a few times.
First time: ~ a month ago I think Last time: today, with 0.21.0
Orientation: portrait and not miniplayer Background playback: enabled Battery optimizations: enabled*
I experience this issue too, with version 0.21.1 I find it totally annoying. It happens in different circumstances. For example when starting the app ist starts playing. or when unlocking the screen.
How can I apply the above workaround by @newhinton on my phone?
Thanks for the investigations @newhinton :+1:
I hope that #5697 fixed this issue (I couldn't test it because my phone only kills the app after a very long time), so please feel free to report back if this improved the situation (in theory it should, but it's Android, so who knows ...)
Steps to reproduce
Maybe is related to this but the opposite behavior.
Expected behavior
Keep the video paused after unlock for long times
Actual behavior
It plays when the devices is locked for about >5-10mins
LibreTube version
0.20.1
Android version
13
Other details
No response
Acknowledgements