-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[ios][video_player] pip - picture in picture #60048
Comments
Sorry if I am pointing the obvious but is there anything wrong with using a |
You don't need to "customize" the view per-say. Why not just get access to the root view controller (FlutterViewController) and add your own layer to that view, or add another view to it. Something like: UIViewController* vc = [[[UIApplication sharedApplication] keyWindow] rootViewController];
MyPipView* pipView = [[MyPipView alloc] init];
[vc.view addSubview:pipView]; |
Thank you @gaaclarke |
@p30arena please reopen, PiP is supported from iOS 14 |
@StefanLobbenmeier Adopting Picture in Picture Playback Use AVPlayerViewController to provide Picture in Picture (PiP) playback on supported iPad models. |
This is the announcement at wwdc: https://youtu.be/GEZhD3J89ZE?t=11m44s . I will check the developer Information for iOS 14 Beta if they also mention it there, but I can confirm on my device (iPhone 7 iOS 14 beta 2) pip works |
The best I could find in the documentation is https://developer.apple.com/documentation/avkit/adopting_picture_in_picture_in_a_custom_player Which mentions neither iPad nor iPhone, but that’s just a subpage of your page so I think o am not looking at the correct place |
I'm also affected by this. My users will expect to be able to continue playing videos while the app is backgrounded wherever the platform supports it. |
Please refer to my github: https://github.com/thanhit93/plugins/tree/master/packages/video_player/video_player |
@thanhit93 thanks for sharing - have you also tested it on iPad? I am a bit unsure about the conditions in your source code / if they only work on iPhone or also iPad |
Hello @StefanLobbenmeier This plugin I just developed. I only tested on iphone (iOS14), ipad hasn't been tested. I will check on the iPad and fix the error as soon as possible. I also look forward to contributing from anyone to make the plugin even better. |
@thanhit93 This looks great. It would be better if it could be made into a plug-in package. Thank you |
any updates? |
very useful feature! |
@thanhit93 How do I use it in my project? |
Yes, it is important to use the |
I was trying everything but could not make it work, so i created an ios project and implemented the pip mode there, it was working perfectly, but the same code wasn't working in Flutter, i was so confused. But i think i got it now, when we attach the |
Hmm do you still have the code for that? Maybe it would help me to simplify the code for the pip as well |
But from my testing I wasn't able to get it working. But again, I am not an iOS dev so maybe I am missing something. Tonight I will be opening my pull request again :D |
https://github.com/developerinsider/Picture-in-Picture-iOS-14-Demo |
Oeeeef!! Nice! :D thanks alot! |
And also, while the pip is getting enabled automatically now, right after going into the pip mode, the video is getting paused. Whereas in the example project which you have provided, it continues playing, Have you explicitly handled it, or do you think it might have to do something with my code. |
It has been a while since I implemented it. I will double check this evening |
Thanks a lot for your help :) |
@vanlooverenkoen I also want to help. Can you just mention a starting point so I can build for it? |
Check out the pull request I made and run the example to start |
@vanlooverenkoen @krishaajtak |
You can checkout the PiP branch (pr) it is working for us in production for almost 2 years already |
@vanlooverenkoen |
Hi @vanlooverenkoen , |
You can take a look at the PR I have open, that contains the full implementation for PIP using video_player flutter/packages#3500 maybe you can find something there |
I want to use pip mode in video player with play push button in flotation |
for alternative on ios use this package https://pub.dev/packages/flutter_to_airplay |
@vanlooverenkoen Thanks for great contribution. i need a way, so user can switch between screens without removing pip screen. is that possible ? |
Use case
I have a customer asking for PIP when the app is playing a video and the user wants multi-tasking.
For Android I had to edit the plugin, and use this line of code:
getActivity().enterPictureInPictureMode();
https://developer.android.com/guide/topics/ui/picture-in-picture#java
But for iOS, it is a different story, iOS does not support PIP in UIWindow or UIView, it is supported only in a Custom Player.
We need a custom view for that.
https://developer.apple.com/documentation/avkit/adopting_picture_in_picture_in_a_custom_player
https://developer.apple.com/documentation/avfoundation/avplayerlayer
The video_player plugin is using Texture to show the video output.
Proposal
I need a way to customize the UIView created by the engine for the texture and add AVPlayerLayer support to it.
Any suggestions on how can I contribute this feature to the plugin?
The text was updated successfully, but these errors were encountered: