LibreTube icon indicating copy to clipboard operation
LibreTube copied to clipboard

Disable background play when picture in picture is disabled

Open akano12 opened this issue 3 years ago • 3 comments

Describe your suggested feature

When switching to home screen or another screen pause the video or add an option to disable background playing.

Other details

I disabled picture in picture mode because i want the video to stop playing when switching to a new app or home screen but even after disabling it the auido would still play in background.

Searched in settings but only found an option to pause video playing when screen is turned off.

Acknowledgements

  • [x] I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
  • [X] I have written a short but informative title.
  • [X] I will fill out all of the requested information in this form.

akano12 avatar Oct 15 '22 10:10 akano12

The only possible solution for that I'm aware of would be to pause the video when the activity gets destroyed. Negative side effect: It will also be paused when navigating to the settings, about or the community tab :/

Bnyro avatar Oct 17 '22 17:10 Bnyro

The only possible solution for that I'm aware of would be to pause the video when the activity gets destroyed. Negative side effect: It will also be paused when navigating to the settings, about or the community tab :/

I have a suggestions (might sound dumb), can't you just add few bool values to make it possible? First one for picture in picture (ifPipEnabled bool), second for current app state (ifBackground bool).

So if PiP is enabled and app is in background proceed to show the pip player else pause video?

akano12 avatar Oct 17 '22 22:10 akano12

Well, unfortunately it's not that easy as Android has its own lifecycle ecosystem which makes it really hard to detect whether the app is active or not.

Bnyro avatar Oct 18 '22 07:10 Bnyro

Side note: Forget what I wrote here previously, apparently I forgot about the easiest way to solve the issue when answering 😂

Bnyro avatar Dec 05 '22 21:12 Bnyro

This feature is undesirable. I want music to play in the background, and I don't want picture-in-picture either.

I think a better approach is to use these 3 options and let the user select what works for them:

  1. Pause video when app is in background
  2. Use PiP when app is in background
  3. Use background playback without PiP

Svk1190 avatar Dec 16 '22 20:12 Svk1190

Ditto on @Svk1190's suggestion, but I find that background playback in LibreTube is spotty at best; usually it'll either stop loading the video or the process is killed entirely when it's playing in the background.

SeongGino avatar Dec 16 '22 21:12 SeongGino

Well, you should always start the audio only/background mode explicitly when using the app in the background without PiP because Android's gonna kill it otherwise.

Bnyro avatar Dec 16 '22 21:12 Bnyro

This doesn't seem good to me. Switching the app pauses the playback & there's no way to disable that.

Click on "Audio" then switch app for the audio to play in background.

akano12 avatar Dec 17 '22 17:12 akano12

It seems that no matter what the devs do it's never enough and there'll always be someone to nag and complain.

@Bnyro if you want to revert the change it's fine. I'll clone and build LT with this feature included (if this will make others stop crying)

akano12 avatar Dec 17 '22 20:12 akano12

It seems that no matter what the devs do it's never enough and there'll always be someone to nag and complain.

I don't really get their point though, when not using the background/audio only mode Android will stop the player within 5 minutes to save battery/resources, so continuing the video when PiP is disabled doesn't really make sense in my opinion.

Bnyro avatar Dec 18 '22 10:12 Bnyro

It seems that no matter what the devs do it's never enough and there'll always be someone to nag and complain.

I don't really get their point though, when not using the background/audio only mode Android will stop the player within 5 minutes to save battery/resources, so continuing the video when PiP is disabled doesn't really make sense in my opinion.

Before you implemented this, if you had PiP disabled and switched to home or any other app, audio would continue playing in the background. Possible or not, they just want it back. (Probably they're businessmen who can't afford wasting 1-2 seconds to toggle audio only from the player)

akano12 avatar Dec 18 '22 13:12 akano12