libre-tube / LibreTube

An alternative frontend for YouTube, for Android.
https://libretube.dev
GNU General Public License v3.0
8.75k stars 445 forks source link

Due to screen timeout, the next video does not play in the background when the screen turns off #6751

Closed Figim closed 2 hours ago

Figim commented 3 hours ago

Steps to reproduce

Battery optimization is disabled. This problem is due to screen timeout

  1. Play a 5-minute video
  2. Then exit the app
  3. Turn off the screen
  4. Wait for the video to end
  5. Wait a little longer
  6. But it won't be played. The player has stopped

Expected behavior

As of Android 12, the screen must be left on in the background for the invincible service option to work.

You need to prevent the screen break in the background

Actual behavior

Does not interfere with the screen break in the background

LibreTube version

0.26.0 Debug

Android version

Android 12+

Other details

You must prevent background screen pause

Acknowledgements

Bnyro commented 2 hours ago

If so, that's media3 library bug.

Figim commented 2 hours ago

I don't know, but another project has this option. Why does LibreTube do this when the screen turns off? As soon as you open the screen, the video plays

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:keepScreenOn="true"> ...

https://developer.android.com/develop/background-work/background-tasks/awake/screen-on

https://developer.android.com/guide/components/activities/process-lifecycle