-
Notifications
You must be signed in to change notification settings - Fork 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
[video_player_avfoundation] Platform view support #8237
base: main
Are you sure you want to change the base?
[video_player_avfoundation] Platform view support #8237
Conversation
… and platform view for each video
/// The next non-texture player ID, initialized to a high number to avoid collisions with | ||
/// texture IDs (which are generated separately). | ||
static int64_t nextNonTexturePlayerId = 1000000; |
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'm not sure if this is the best approach, but looks like texture ids start from 0 and then get incremented, so this starting point seems to be pretty safe. Alternatively, I assume we could generate random ids for non-texture players
7a727b9
to
0184df3
Compare
0184df3
to
5f31fc3
Compare
This reverts commit eba2c36.
One PR check is failing, but this is due to changes in platform interface and local dependency overrides. The code can be reviewed already. Once this PR is reviewed, I'll create another one with platform interface changes only (according to |
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
parameter 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.
Resolves #86613 (not fully though, as it is not yet available in the app-facing package).
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.