SkyTubeTeam / SkyTube

Copylefted libre / open source YouTube player for Android
GNU General Public License v3.0
2.35k stars 326 forks source link

Background playback stops after some time #600

Open avently opened 4 years ago

avently commented 4 years ago

Android kills the app after some time of background playback. It happens after ~10 minutes if screen is off or app is hidden. This way you get stopped playback, the playback can be started from the start of a video (current position is lost), controls in appbar menu have duplicates (reload button and others).

How to reproduce: Play any long video Hide the app in the playing state Wait some time before a stop of audio.

okan35 commented 4 years ago

As someone who had issues with Android app killing problem, this could be both programming and phone settings issue. I had to solve similar issue on Huawei and Xiaomi phones, I solved it by both code change and phone battery settings. Without phone battery settings your code won't be able to do anything to prevent system from killing the app. So I would suggest trying this by setting no restrictions for skytube app and let it work on background. Any setting that does this should be applied.

13r0ck commented 4 years ago

Ya I think okan35 is correct. In you phone settings search for "battery optimization" or something similar. Make sure that the app is set to "not optimized".

If that fixes the issue, then SkyTube could add a feature similar to the Microsoft authenticator app. To enable features in that app, it will ask that the user disable battery optimization, and then send the user to the system settings to turn it off for the app.

hamishmb commented 2 years ago

Can confirm I have this issue when I turn the screen off with SkyTube in the foreground. A little prompt about battery optimisation would be nice. I haven't yet tried disabling battery optimisation but I will report back with results.