-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[video_player] ios picture in picture #6284
Conversation
fetch upstream
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few questions. not a complete review yet (will need to look into apple's api doc)
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
Thanks already for your fast reviews!!! This is the first objective-c code I have ever written!! I will make the changes tomorrow!! |
As a high-level note: as discussed in your previous PR, we require test coverage. There's currently no testing of the native part of this change, which is the most important part. Do you have a plan in place to add native tests, so that this doesn't end up being eventually closed as incomplete like that previous PR? We should hold off on detailed review until that has been addressed. |
@stuartmorgan indeed I get that, in the meantime is there somebody at Flutter that can help me with that? Just to make sure that I a working on the correct thing. I should write the tests in video_player_avfoundation/example/ios/RunnerTest & video_player_avfoundation/example/ios/RunnerUITests |
If you have specific questions, please ask them and someone can answer.
Yes, for a case like this where integration tests can't inspect the results meaningfully, native tests would be needed. |
Also, you need to follow https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins so that the PR can actually run tests. |
@stuartmorgan thanks for the info. I will start with that! I will let you know when I need something else. |
@stuartmorgan I created a UI test for opening & closing the pip. also for checking if pip is supported. That covers all 3 methods. |
@stuartmorgan & @jmagman updated the gif with the latest demo UI & way smaller size, comparable to demo_ipod.gif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tests are failing in CI running on iPhone simulators that do not support PiP.
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
Outdated
Show resolved
Hide resolved
packages/video_player/video_player_avfoundation/example/ios/RunnerTests/VideoPlayerTests.m
Outdated
Show resolved
Hide resolved
@@ -634,4 +724,23 @@ - (void)setMixWithOthers:(FLTMixWithOthersMessage *)input | |||
} | |||
} | |||
|
|||
- (void)preparePictureInPicture:(FLTPreparePictureInPictureMessage *)input | |||
error:(FlutterError **)error { | |||
FLTVideoPlayer *player = self.playersByTextureId[input.textureId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like:
- (BOOL)doesInfoPlistSupportPictureInPicture:(FlutterError **)error {
NSArray *backgroundModes = [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIBackgroundModes"];
if (![backgroundModes isKindOfClass:[NSArray class]] ||
![backgroundModes containsObject:@"audio"]) {
*error = [FlutterError errorWithCode:@"video_player"
message:@"missing audio UIBackgroundModes audio in Info.plist"
details:nil];
return NO;
}
return YES;
}
- (void)startPictureInPicture:(FLTStartPictureInPictureMessage *)input
error:(FlutterError **)error {
if (![self doesInfoPlistSupportPictureInPicture:error]) {
return;
}
FLTVideoPlayer *player = self.playersByTextureId[input.textureId];
[player startOrStopPictureInPicture:YES];
}
- (void)stopPictureInPicture:(FLTStopPictureInPictureMessage *)input error:(FlutterError **)error {
if (![self doesInfoPlistSupportPictureInPicture:error]) {
return;
}
FLTVideoPlayer *player = self.playersByTextureId[input.textureId];
[player startOrStopPictureInPicture:NO];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't mean to approve this yet based on the failing tests 🙂
Checkin from triage: Is this just waiting for another review from @jmagman ? On the CI failures, you probably just need to add a path override for |
@stuartmorgan I updated the |
It's
It's line 326, not 328. See #7074 for the solution to the remaining issue. |
Alright I see, I did not know master was always used. I will fix that one |
We test both |
Makes sense, will that not result in a breaking ci for stable? |
No; unnecessary |
Hmm I don't get it, what should I be doing to get everything green? Because now stable fails |
Please replicate the pattern from the PR I linked to above (including exactly duplicating the comment). |
Aah, alright din't know I had to really ignore it. |
We've just completed the migration of the plugin code to the flutter/packages repository, as described in https://flutter.dev/go/flutter-plugins-repo-migration, and this repository is now being archived. Unfortunately that means that all in-progress PRs here must be moved to flutter/packages. Please see our instructions for an explanation of how to move your PR, and if you have any issues moving your PR please don't hesitate to reach out in the #hackers-ecosystem channel in Discord. Our apologies that your PR was caught in this one-time transition. We're aware that it's disruptive in the short term, and appreciate your help in getting us to a better long-term state! |
Added support for picture in picture video playback
video-player-pip-demo-ios.MP4
This feature is only available on iOS because android has a different implementation. simple_pip_mode can be used for Android
flutter/flutter#60048
No migration needed this is an addon
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.