NewPipe icon indicating copy to clipboard operation
NewPipe copied to clipboard

[Android 8.0+] Add Android Picture in Picture support

Open arunkcx opened this issue 6 years ago • 22 comments

With the latest Android Q beta release, apps installed outside the play store have their Screen Overlay permission revoked in 30 seconds after enabling them. This is to track down and stop shady apk apps which abuse the screen overlay option and get users to click on things they didn't mean to, malware etc. More info in article below

https://www.androidpolice.com/2019/03/16/android-q-steps-up-the-fight-up-against-overlay-based-malware/

Problem is, NewPipe uses screen overlay for the popup and having to re-enable the permission every time a new popup video is being played... The ideal solution is to switch to the native PIP mode from Oreo API 26 and up, and leave the existing floating player code for Android Nougat and older.

https://developer.android.com/guide/topics/ui/picture-in-picture

Slowly as dev time goes on and more users move to Oreo and higher, the floating player method can switch to PIP completely.

arunkcx avatar Mar 17 '19 14:03 arunkcx

Sad. Google is 100% annoying recently. So yea I guess we need pip now. We might also need help for that.

theScrabi avatar Mar 17 '19 20:03 theScrabi

No issue so far with the emulator. Tested by rebooting the emulator.

My AVD Config

PeterHindes avatar Dec 06 '19 17:12 PeterHindes

It seems like it was a bug, or a test with Android Q beta that has been reverted ( https://teddit.net/r/Android/comments/b5y1yz/allow_display_over_other_apps_and_other/ ).

The issue stays open because we should still implement Android's picture in picture.

B0pol avatar Feb 05 '21 20:02 B0pol

@B0pol Does PiP lack or implement any features different from NewPipe's popup player?

opusforlife2 avatar Feb 05 '21 20:02 opusforlife2

It lacks resizability on Android 10- (new feature in android 11) and I think we can add buttons (speed, subtitles) but I'm not sure. Users are used to Android PiP because other apps. We won't need to maintain it because Android will.

But then because it does not bring a lot of benefits, it does not have a high priority indeed.

B0pol avatar Feb 05 '21 21:02 B0pol

Then we should probably wait until the minimum Google-supported Android version is 11, which will take 3 years, I think.

opusforlife2 avatar Feb 13 '21 14:02 opusforlife2

With the advent of Android 12, overlays have become restrictive to the point that activating them essentially renders all other OS interaction useless.

https://developer.android.com/about/versions/12/behavior-changes-all#untrusted-touch-events

The Android 12 PiP now supports resizing and even includes features NewPipe currently does not support: "stashing" and smooth transitioning when exiting PiP. And, speaking of which, the gesture to dismiss PiP is now effortless. You don't have to carefully target a specific touch point, you just fling the window down vaguely toward the bottom and Android gets the gist and closes it for you.

The time to move on to PiP is now (at least for Android 12+).

PacoBell avatar Oct 31 '21 09:10 PacoBell

Alternatively, it seems one could use ADB as a workaround on an individual basis:

adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES com.example.app

PacoBell avatar Oct 31 '21 09:10 PacoBell

I would take on this issue as a direct victim of the changes Google introduced 😅

But first I would like to address the issue of compatibility with the existing popup. In my opinion the best solutions would be to either make the PiP player dependent on the Android version (Starting with the first that needs it -> 12.0+) or as already mentioned by @dbenjaminmiller on #6770 as an option in the player settings. Personally I prefer the first one, as it is more user friendly, but with the ability to switch back to the old popup player.

Any opinions on this?

schnatzi avatar Nov 03 '21 17:11 schnatzi

Any opinions on this?

I agree here. The option in the menu should be a drop-down between:

  • Auto (use PiP on Android 12 and overlay on 11 and earlier)
  • Force use PiP
  • Force use Overlay

Providing an option is good in case one has problems, and the overlay version should stay in place in the event that either Google makes a fix (such as adding a permission to allow overlay touches) or the user is on a previous version of Android.

Please let us know about your progress as work continues.

EliteMasterEric avatar Nov 08 '21 17:11 EliteMasterEric

Agree with @MasterEric drop-down menu. Defaulting on auto but being able to overrule it would be great for everyones needs.

grayum avatar Nov 10 '21 16:11 grayum

@schnatzi assigned. :)

triallax avatar Nov 12 '21 18:11 triallax

@schnatzi Any progress with this?

opusforlife2 avatar Jan 25 '22 17:01 opusforlife2

Because of the lack of response of @schnatzi, someone else can now work on this issue.

Free feel to ask for help if you have difficulties to implement this feature here and on our IRC channel.

AudricV avatar Feb 07 '22 19:02 AudricV

@B0pol This issue should be closed as #6770 has way more discussion. Separate issues should not be required to open for the same thing.

SameenAhnaf avatar Feb 08 '22 09:02 SameenAhnaf

@TiA4f8R: Sorry, I missed the notification. I haven't made significant progress on this matter.

I failed to locate the current code for the popup player or as I understand the fragment which it is part of. I didn't follow up on this, because I'm currently involved with other stuff.

If nobody else is going to implement this, I will pick it up again, but I have to take some exams first 🥲

schnatzi avatar Feb 08 '22 09:02 schnatzi

If it's not done by the player and all its components rewrite, I suggest to work on this only after the player rewrite is done.

AudricV avatar Feb 25 '22 17:02 AudricV

Any update on this? This is most important feature for android 12 user, what is the benefit of pop up media player when you can't interact with other apps. Please devs make it top priority Thanks

MominRaza avatar Mar 13 '22 19:03 MominRaza

Curiously, this seems to be working for me with version 0.23.1 on my S22 Ultra. On prior versions, picture-in-pucture was not working.

infinitytec avatar Jul 09 '22 03:07 infinitytec

@infinitytec that bug was fixed in https://github.com/TeamNewPipe/NewPipe/pull/8279. Note that we're still not using Android's PiP player, but our own custom popup player.

triallax avatar Jul 10 '22 08:07 triallax

If it's not done by the player and all its components rewrite, I suggest to work on this only after the player rewrite is done.

Note that the player rewrite has been completed. Nothing should prevent now tries to implement this feature, even if changes to its structure/core may be required!

AudricV avatar Jul 16 '22 19:07 AudricV

any updates to this?

ghost avatar Feb 01 '25 21:02 ghost