mediathekview / zapp

German public broadcasting live streams as an Android app
https://mediathekview.de/news/zapp/
MIT License
206 stars 34 forks source link

Feature: Automatically switch to PiP #319

Closed EvilBMP closed 1 year ago

EvilBMP commented 2 years ago

It would be nice, if Zapp would automatically switch to PiP mode, if one minimizes the app or switch to another app, via app switcher.

Also, it would be nice, if PiP is active, that turning off the screen would result in automatic background playback.

So going to the 3-dots menu in the top right corner during playback could be skipped.

YouTube Vanced works/ worked that way and I find that really convenient 🙂

cemrich commented 2 years ago

I find this feature very stressfull and would not like to enable it by default. But i'll try to find out if this is something more users might like.

EvilBMP commented 2 years ago

I have no problem with a switch in the settings, that allows to en- or disable such a feature ;-)

Ver-Nunft commented 1 year ago

that would be two great options

cemrich commented 1 year ago

Note to self:

This would require a new preferences section along the line of "video player". This may contain the existing "Videos always in landscape mode" setting and the new "Resume playback in picture in picture mode" setting.

cemrich commented 1 year ago

How other apps do it

Youtube

New Pipe

Netflix

VLC

cemrich commented 1 year ago

Switching to picture in picture on back press is very easy by placing this in AbstractPlayerActivity::onCreate:

onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
    override fun handleOnBackPressed() {
        MultiWindowHelper.enterPictureInPictureMode(this@AbstractPlayerActivity)
    }
})

However, there are some subtle bugs when switching videos while in picture in picture mode. And there is #168

cemrich commented 1 year ago

The related bugs first to fix are: #341 #340

cemrich commented 1 year ago

This issue is now implemented with upcoming version 8.1.0. Pip will start (after enabling it in preferences) after a back press from the video player. Turning the screen off during playback will switch to background playback.