Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android 8.0+] Add Android Picture in Picture support #2223

Open
arunkcx opened this issue Mar 17, 2019 · 21 comments
Open

[Android 8.0+] Add Android Picture in Picture support #2223

arunkcx opened this issue Mar 17, 2019 · 21 comments
Labels
device/software specific Issues that only happen on some devices or with some specific hardware/software help wanted Help is wanted in fixing this issue player Issues related to any player (main, popup and background)

Comments

@arunkcx
Copy link

arunkcx commented Mar 17, 2019

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.

@theScrabi
Copy link
Member

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

@Stypox Stypox added the player Issues related to any player (main, popup and background) label Aug 27, 2019
@Stypox Stypox added help wanted Help is wanted in fixing this issue device/software specific Issues that only happen on some devices or with some specific hardware/software labels Sep 27, 2019
@PeterHindes
Copy link
Contributor

PeterHindes commented Dec 6, 2019

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

My AVD Config

@B0pol B0pol mentioned this issue Feb 5, 2021
3 tasks
@B0pol B0pol changed the title [Android Q] Replace Overlay with Picture in Picture, due to security changes [Android Q] Replace Overlay with Picture in Picture Feb 5, 2021
@B0pol
Copy link
Member

B0pol commented Feb 5, 2021

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.

@opusforlife2
Copy link
Collaborator

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

@B0pol
Copy link
Member

B0pol commented Feb 5, 2021

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.

@opusforlife2
Copy link
Collaborator

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

@PacoBell
Copy link

PacoBell commented Oct 31, 2021

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
Copy link

PacoBell commented Oct 31, 2021

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

@opusforlife2 opusforlife2 changed the title [Android Q] Replace Overlay with Picture in Picture [Needed for Android 12] Replace Overlay with Picture in Picture Nov 1, 2021
@schnatzi
Copy link

schnatzi commented Nov 3, 2021

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?

@EliteMasterEric
Copy link

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.

@grayum
Copy link

grayum commented Nov 10, 2021

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

@triallax
Copy link
Contributor

@schnatzi assigned. :)

@opusforlife2
Copy link
Collaborator

@schnatzi Any progress with this?

@AudricV
Copy link
Member

AudricV commented Feb 7, 2022

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.

@SameenAhnaf

This comment was marked as off-topic.

@schnatzi
Copy link

schnatzi commented Feb 8, 2022

@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 🥲

@AudricV
Copy link
Member

AudricV commented Feb 25, 2022

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.

@MominRaza

This comment was marked as spam.

@AudricV AudricV changed the title [Needed for Android 12] Replace Overlay with Picture in Picture [Android 8.0+] Add Android Picture in Picture support Apr 23, 2022
@infinitytec
Copy link

infinitytec commented Jul 9, 2022

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.

@triallax
Copy link
Contributor

@infinitytec that bug was fixed in #8279. Note that we're still not using Android's PiP player, but our own custom popup player.

@AudricV
Copy link
Member

AudricV commented Jul 16, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device/software specific Issues that only happen on some devices or with some specific hardware/software help wanted Help is wanted in fixing this issue player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging a pull request may close this issue.