-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[video_player] Update iOS/macOS to Pigeon 13 #5270
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 2.5.1 | ||
|
|
||
| * Updates to Pigeon 13. | ||
|
|
||
| ## 2.5.0 | ||
|
|
||
| * Adds support for macOS. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -512,7 +512,7 @@ - (int64_t)duration { | |
| return FVPCMTimeToMillis([[[_player currentItem] asset] duration]); | ||
| } | ||
|
|
||
| - (void)seekTo:(int)location completionHandler:(void (^)(BOOL))completionHandler { | ||
| - (void)seekTo:(int64_t)location completionHandler:(void (^)(BOOL))completionHandler { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were calling this with |
||
| CMTime locationCMT = CMTimeMake(location, 1000); | ||
| CMTimeValue duration = _player.currentItem.asset.duration.value; | ||
| // Without adding tolerance when seeking to duration, | ||
|
|
@@ -670,7 +670,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { | |
| // https://github.com/flutter/flutter/issues/135320 | ||
| [registrar publish:instance]; | ||
| #endif | ||
| FVPAVFoundationVideoPlayerApiSetup(registrar.messenger, instance); | ||
| SetUpFVPAVFoundationVideoPlayerApi(registrar.messenger, instance); | ||
| } | ||
|
|
||
| - (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { | ||
|
|
@@ -709,7 +709,7 @@ - (FVPTextureMessage *)onPlayerSetup:(FVPVideoPlayer *)player | |
| [eventChannel setStreamHandler:player]; | ||
| player.eventChannel = eventChannel; | ||
| self.playersByTextureId[@(textureId)] = player; | ||
| FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:@(textureId)]; | ||
| FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:textureId]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it pigeon's change? the new pigeon supports primitives and the old version does not?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I changed Pigeon's Obj-C generator to stop boxing non-nullable values, to make its generated code more idiomatic and less error-prone (given that it turns out Xcode is less reliable about warning for buggy implicit |
||
| return result; | ||
| } | ||
|
|
||
|
|
@@ -761,9 +761,10 @@ - (FVPTextureMessage *)create:(FVPCreateMessage *)input error:(FlutterError **)e | |
| } | ||
|
|
||
| - (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| [self.registry unregisterTexture:input.textureId.intValue]; | ||
| [self.playersByTextureId removeObjectForKey:input.textureId]; | ||
| NSNumber *playerKey = @(input.textureId); | ||
| FVPVideoPlayer *player = self.playersByTextureId[playerKey]; | ||
| [self.registry unregisterTexture:input.textureId]; | ||
| [self.playersByTextureId removeObjectForKey:playerKey]; | ||
| // If the Flutter contains https://github.com/flutter/engine/pull/12695, | ||
| // the `player` is disposed via `onTextureUnregistered` at the right time. | ||
| // Without https://github.com/flutter/engine/pull/12695, there is no guarantee that the | ||
|
|
@@ -783,46 +784,46 @@ - (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error { | |
| } | ||
|
|
||
| - (void)setLooping:(FVPLoopingMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| player.isLooping = input.isLooping.boolValue; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| player.isLooping = input.isLooping; | ||
| } | ||
|
|
||
| - (void)setVolume:(FVPVolumeMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| [player setVolume:input.volume.doubleValue]; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| [player setVolume:input.volume]; | ||
| } | ||
|
|
||
| - (void)setPlaybackSpeed:(FVPPlaybackSpeedMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| [player setPlaybackSpeed:input.speed.doubleValue]; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| [player setPlaybackSpeed:input.speed]; | ||
| } | ||
|
|
||
| - (void)play:(FVPTextureMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| [player play]; | ||
| } | ||
|
|
||
| - (FVPPositionMessage *)position:(FVPTextureMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| FVPPositionMessage *result = [FVPPositionMessage makeWithTextureId:input.textureId | ||
| position:@([player position])]; | ||
| position:[player position]]; | ||
| return result; | ||
| } | ||
|
|
||
| - (void)seekTo:(FVPPositionMessage *)input | ||
| completion:(void (^)(FlutterError *_Nullable))completion { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| [player seekTo:input.position.intValue | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| [player seekTo:input.position | ||
| completionHandler:^(BOOL finished) { | ||
| dispatch_async(dispatch_get_main_queue(), ^{ | ||
| [self.registry textureFrameAvailable:input.textureId.intValue]; | ||
| [self.registry textureFrameAvailable:input.textureId]; | ||
| completion(nil); | ||
| }); | ||
| }]; | ||
| } | ||
|
|
||
| - (void)pause:(FVPTextureMessage *)input error:(FlutterError **)error { | ||
| FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; | ||
| FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)]; | ||
| [player pause]; | ||
| } | ||
|
|
||
|
|
@@ -831,7 +832,7 @@ - (void)setMixWithOthers:(FVPMixWithOthersMessage *)input | |
| #if TARGET_OS_OSX | ||
| // AVAudioSession doesn't exist on macOS, and audio always mixes, so just no-op. | ||
| #else | ||
| if (input.mixWithOthers.boolValue) { | ||
| if (input.mixWithOthers) { | ||
| [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback | ||
| withOptions:AVAudioSessionCategoryOptionMixWithOthers | ||
| error:nil]; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
nit ' ' -> ' '.
I can't believe this got merged... /s
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.
Doh! Luckily it shouldn't show up that way on pub.dev.