sschueller / peertube-android

Thorium, a PeerTube Android Client
https://github.com/Chocobozzz/PeerTube
GNU Affero General Public License v3.0
341 stars 53 forks source link

[FR] play in floating window #154

Closed ildar closed 4 years ago

ildar commented 4 years ago

as other video player do: NewPipe, VLC,...

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/84349031-fr-play-in-floating-window?utm_campaign=plugin&utm_content=tracker%2F89466969&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F89466969&utm_medium=issues&utm_source=github).
dhk2 commented 4 years ago

Got this working on my test system. There's some Android version specific code that will require more testing on various versions though. Adding a button was being difficult so I put switching to floating mode on a longpress of the full screen button.

sschueller commented 4 years ago

Got this working on my test system. There's some Android version specific code that will require more testing on various versions though. Adding a button was being difficult so I put switching to floating mode on a longpress of the full screen button.

Ideally I would like this to function like the youtube app (with background play enabled). While playing the video it can be dragged down and continues to play at the bottom or if the back button is pressed the same happens. If one suspends the app the video runs in a floating window which can be dragged around. The floating window would not occur if the background play options is disabled.

dhk2 commented 4 years ago

makes sense.

dhk2 commented 4 years ago

I'm about 80% of the way there. In order to keep orphaned floating windows from happening when opening different videos I had to change the #launchmode of videoplayactivity in the manifest from "singletop" to "singletask". Everything seems to be working properly after the change. I can't see a need for multiple instances of the video player activity, but I might be missing something.

dhk2 commented 4 years ago

Of course, after creating the pull request I figured out that switching it to singleinstance allows me to fix the problem where the back button went back to home screen instead of video list after restoring from PIP mode. If the video list is destroyed while in PIP mode it will reopen the default view on backpress now. Youtube is able to keep the full back stack due to using fragments so the fragment manager keeps track even if the activity goes away. That would require a degree of re-architecting I'm not ready for yet :) I think I've figured out how the get the video to play at the bottom of the screen without using PIP mode, now to see if I can duplicate it.

sschueller commented 4 years ago

@dhk2 Your addition is in release v1.0.39. Thanks, closing this for now.