-
Notifications
You must be signed in to change notification settings - Fork 0
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
[DRAFT] video_player platform view support #1
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,20 @@ | |||
#import "FVPFrameUpdater.h" |
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.
Whole file content extracted from FVPVideoPlayerPlugin.m
@@ -0,0 +1,164 @@ | |||
#import "FVPVideoPlayerTextureApproach.h" | |||
|
|||
@implementation FVPVideoPlayerTextureApproach |
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.
This code was a part of FVPVideoPlayer
class. It is all related to texture approach. I extracted it from FVPVideoPlayer
and put here. This class extends FVPVideoPlayer
and adds texture approach specific code.
...ndation/Sources/video_player_avfoundation/include/video_player_avfoundation/FVPVideoPlayer.h
Show resolved
Hide resolved
4059fbf
to
15618d5
Compare
- (instancetype)initWithURL:(NSURL *)url | ||
httpHeaders:(nonnull NSDictionary<NSString *, NSString *> *)headers | ||
avFactory:(id<FVPAVFactory>)avFactory | ||
registrar:(NSObject<FlutterPluginRegistrar> *)registrar; | ||
|
||
- (instancetype)initWithPlayerItem:(AVPlayerItem *)item | ||
avFactory:(id<FVPAVFactory>)avFactory | ||
registrar:(NSObject<FlutterPluginRegistrar> *)registrar; | ||
|
||
- (instancetype)initWithAsset:(AVPlayerItem *)item | ||
avFactory:(id<FVPAVFactory>)avFactory | ||
registrar:(NSObject<FlutterPluginRegistrar> *)registrar; | ||
|
||
- (void)updatePlayingState; | ||
|
||
- (void)dispose; | ||
|
||
- (void)disposeSansEventChannel; | ||
|
||
- (void)setVolume:(double)volume; | ||
|
||
- (void)setPlaybackSpeed:(double)speed; | ||
|
||
- (void)play; | ||
|
||
- (void)pause; | ||
|
||
- (void)seekTo:(int64_t)location completionHandler:(void (^)(BOOL))completionHandler; |
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.
I had to add many of these methods to the interface because they were referenced in FVPVideoPlayerPlugin.m
(and now the player is not longer a part of that file)
a0ac882
to
3ff70e8
Compare
223fedc
to
282e746
Compare
eae938d
to
60a1733
Compare
455eec0
to
b19ca86
Compare
2caee49
to
f04ed06
Compare
0dd88a2
to
c2117a8
Compare
7a727b9
to
0184df3
Compare
0184df3
to
5f31fc3
Compare
This reverts commit eba2c36.
This PR adds support for platform views on iOS as a way of displaying a video. When creating a video, it's now possible to choose between texture view approach (rendered using
Texture
widget on the Flutter side) and platform view approach (rendered on the native side, usingAVPlayerLayer
).FVPVideoPlayer
class now has nothing to do with texture. The texture-related code was moved from it toFVPVideoPlayerTextureApproach
- a subclass ofFVPVideoPlayer
that adds texture functionality. In the plugin class (createWithOptions
method) we create either the basic version (for platform view) or the texture subclass (in case of texture approach) based on the parameter passed in from Flutter side.Platform view is only supported on iOS, no MacOS implementation is added in this PR. The functionality is not yet exposed in the app-facing package (only in example app) - it will be done later, once we add the Android implementation. The PR does not introduce breaking changes, I followed the rule "non-breaking changes, even at the expense of a less-clean API" (
buildViewWithOptions
method,viewType
inDataSource
).Up to this point, the variable naming relied heavily on the texture (we had a lot of
textureId
variables and properties). Since now you can use a platform view instead of a texture view, these variables and parameters will be renamed to justplayerId
. This will be done in a separate PR to keep git diff for this one clean.I left some comments in the PR to clarify/discuss some choices.
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, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.