[video_player] Update iOS/macOS to Pigeon 13 (#5270)

Picks up several breaking changes, including the switch to unwrapped BOOL properties.
This commit is contained in:
stuartmorgan
2023-10-31 12:09:46 -07:00
committed by GitHub
parent e7ebc2071f
commit 1ac75cfbc7
9 changed files with 210 additions and 130 deletions

View File

@ -1,3 +1,7 @@
## 2.5.1
* Updates to Pigeon 13.
## 2.5.0 ## 2.5.0
* Adds support for macOS. * Adds support for macOS.

View File

@ -512,7 +512,7 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
return FVPCMTimeToMillis([[[_player currentItem] asset] duration]); return FVPCMTimeToMillis([[[_player currentItem] asset] duration]);
} }
- (void)seekTo:(int)location completionHandler:(void (^)(BOOL))completionHandler { - (void)seekTo:(int64_t)location completionHandler:(void (^)(BOOL))completionHandler {
CMTime locationCMT = CMTimeMake(location, 1000); CMTime locationCMT = CMTimeMake(location, 1000);
CMTimeValue duration = _player.currentItem.asset.duration.value; CMTimeValue duration = _player.currentItem.asset.duration.value;
// Without adding tolerance when seeking to duration, // Without adding tolerance when seeking to duration,
@ -670,7 +670,7 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
// https://github.com/flutter/flutter/issues/135320 // https://github.com/flutter/flutter/issues/135320
[registrar publish:instance]; [registrar publish:instance];
#endif #endif
FVPAVFoundationVideoPlayerApiSetup(registrar.messenger, instance); SetUpFVPAVFoundationVideoPlayerApi(registrar.messenger, instance);
} }
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { - (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
@ -709,7 +709,7 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
[eventChannel setStreamHandler:player]; [eventChannel setStreamHandler:player];
player.eventChannel = eventChannel; player.eventChannel = eventChannel;
self.playersByTextureId[@(textureId)] = player; self.playersByTextureId[@(textureId)] = player;
FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:@(textureId)]; FVPTextureMessage *result = [FVPTextureMessage makeWithTextureId:textureId];
return result; return result;
} }
@ -761,9 +761,10 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
} }
- (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error { - (void)dispose:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; NSNumber *playerKey = @(input.textureId);
[self.registry unregisterTexture:input.textureId.intValue]; FVPVideoPlayer *player = self.playersByTextureId[playerKey];
[self.playersByTextureId removeObjectForKey:input.textureId]; [self.registry unregisterTexture:input.textureId];
[self.playersByTextureId removeObjectForKey:playerKey];
// If the Flutter contains https://github.com/flutter/engine/pull/12695, // If the Flutter contains https://github.com/flutter/engine/pull/12695,
// the `player` is disposed via `onTextureUnregistered` at the right time. // the `player` is disposed via `onTextureUnregistered` at the right time.
// Without https://github.com/flutter/engine/pull/12695, there is no guarantee that the // Without https://github.com/flutter/engine/pull/12695, there is no guarantee that the
@ -783,46 +784,46 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
} }
- (void)setLooping:(FVPLoopingMessage *)input error:(FlutterError **)error { - (void)setLooping:(FVPLoopingMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
player.isLooping = input.isLooping.boolValue; player.isLooping = input.isLooping;
} }
- (void)setVolume:(FVPVolumeMessage *)input error:(FlutterError **)error { - (void)setVolume:(FVPVolumeMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player setVolume:input.volume.doubleValue]; [player setVolume:input.volume];
} }
- (void)setPlaybackSpeed:(FVPPlaybackSpeedMessage *)input error:(FlutterError **)error { - (void)setPlaybackSpeed:(FVPPlaybackSpeedMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player setPlaybackSpeed:input.speed.doubleValue]; [player setPlaybackSpeed:input.speed];
} }
- (void)play:(FVPTextureMessage *)input error:(FlutterError **)error { - (void)play:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player play]; [player play];
} }
- (FVPPositionMessage *)position:(FVPTextureMessage *)input error:(FlutterError **)error { - (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 FVPPositionMessage *result = [FVPPositionMessage makeWithTextureId:input.textureId
position:@([player position])]; position:[player position]];
return result; return result;
} }
- (void)seekTo:(FVPPositionMessage *)input - (void)seekTo:(FVPPositionMessage *)input
completion:(void (^)(FlutterError *_Nullable))completion { completion:(void (^)(FlutterError *_Nullable))completion {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player seekTo:input.position.intValue [player seekTo:input.position
completionHandler:^(BOOL finished) { completionHandler:^(BOOL finished) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.registry textureFrameAvailable:input.textureId.intValue]; [self.registry textureFrameAvailable:input.textureId];
completion(nil); completion(nil);
}); });
}]; }];
} }
- (void)pause:(FVPTextureMessage *)input error:(FlutterError **)error { - (void)pause:(FVPTextureMessage *)input error:(FlutterError **)error {
FVPVideoPlayer *player = self.playersByTextureId[input.textureId]; FVPVideoPlayer *player = self.playersByTextureId[@(input.textureId)];
[player pause]; [player pause];
} }
@ -831,7 +832,7 @@ NS_INLINE CGFloat radiansToDegrees(CGFloat radians) {
#if TARGET_OS_OSX #if TARGET_OS_OSX
// AVAudioSession doesn't exist on macOS, and audio always mixes, so just no-op. // AVAudioSession doesn't exist on macOS, and audio always mixes, so just no-op.
#else #else
if (input.mixWithOthers.boolValue) { if (input.mixWithOthers) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:nil]; error:nil];

View File

@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly. // Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@ -24,40 +24,40 @@ NS_ASSUME_NONNULL_BEGIN
@interface FVPTextureMessage : NSObject @interface FVPTextureMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId; + (instancetype)makeWithTextureId:(NSInteger)textureId;
@property(nonatomic, strong) NSNumber *textureId; @property(nonatomic, assign) NSInteger textureId;
@end @end
@interface FVPLoopingMessage : NSObject @interface FVPLoopingMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId isLooping:(NSNumber *)isLooping; + (instancetype)makeWithTextureId:(NSInteger)textureId isLooping:(BOOL)isLooping;
@property(nonatomic, strong) NSNumber *textureId; @property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, strong) NSNumber *isLooping; @property(nonatomic, assign) BOOL isLooping;
@end @end
@interface FVPVolumeMessage : NSObject @interface FVPVolumeMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId volume:(NSNumber *)volume; + (instancetype)makeWithTextureId:(NSInteger)textureId volume:(double)volume;
@property(nonatomic, strong) NSNumber *textureId; @property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, strong) NSNumber *volume; @property(nonatomic, assign) double volume;
@end @end
@interface FVPPlaybackSpeedMessage : NSObject @interface FVPPlaybackSpeedMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId speed:(NSNumber *)speed; + (instancetype)makeWithTextureId:(NSInteger)textureId speed:(double)speed;
@property(nonatomic, strong) NSNumber *textureId; @property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, strong) NSNumber *speed; @property(nonatomic, assign) double speed;
@end @end
@interface FVPPositionMessage : NSObject @interface FVPPositionMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithTextureId:(NSNumber *)textureId position:(NSNumber *)position; + (instancetype)makeWithTextureId:(NSInteger)textureId position:(NSInteger)position;
@property(nonatomic, strong) NSNumber *textureId; @property(nonatomic, assign) NSInteger textureId;
@property(nonatomic, strong) NSNumber *position; @property(nonatomic, assign) NSInteger position;
@end @end
@interface FVPCreateMessage : NSObject @interface FVPCreateMessage : NSObject
@ -72,14 +72,14 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, copy, nullable) NSString *uri; @property(nonatomic, copy, nullable) NSString *uri;
@property(nonatomic, copy, nullable) NSString *packageName; @property(nonatomic, copy, nullable) NSString *packageName;
@property(nonatomic, copy, nullable) NSString *formatHint; @property(nonatomic, copy, nullable) NSString *formatHint;
@property(nonatomic, strong) NSDictionary<NSString *, NSString *> *httpHeaders; @property(nonatomic, copy) NSDictionary<NSString *, NSString *> *httpHeaders;
@end @end
@interface FVPMixWithOthersMessage : NSObject @interface FVPMixWithOthersMessage : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method. /// `init` unavailable to enforce nonnull fields, see the `make` class method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithMixWithOthers:(NSNumber *)mixWithOthers; + (instancetype)makeWithMixWithOthers:(BOOL)mixWithOthers;
@property(nonatomic, strong) NSNumber *mixWithOthers; @property(nonatomic, assign) BOOL mixWithOthers;
@end @end
/// The codec used by FVPAVFoundationVideoPlayerApi. /// The codec used by FVPAVFoundationVideoPlayerApi.
@ -105,7 +105,7 @@ NSObject<FlutterMessageCodec> *FVPAVFoundationVideoPlayerApiGetCodec(void);
error:(FlutterError *_Nullable *_Nonnull)error; error:(FlutterError *_Nullable *_Nonnull)error;
@end @end
extern void FVPAVFoundationVideoPlayerApiSetup( extern void SetUpFVPAVFoundationVideoPlayerApi(
id<FlutterBinaryMessenger> binaryMessenger, id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FVPAVFoundationVideoPlayerApi> *_Nullable api); NSObject<FVPAVFoundationVideoPlayerApi> *_Nullable api);

View File

@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly. // Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
#import "messages.g.h" #import "messages.g.h"
@ -72,15 +72,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
@end @end
@implementation FVPTextureMessage @implementation FVPTextureMessage
+ (instancetype)makeWithTextureId:(NSNumber *)textureId { + (instancetype)makeWithTextureId:(NSInteger)textureId {
FVPTextureMessage *pigeonResult = [[FVPTextureMessage alloc] init]; FVPTextureMessage *pigeonResult = [[FVPTextureMessage alloc] init];
pigeonResult.textureId = textureId; pigeonResult.textureId = textureId;
return pigeonResult; return pigeonResult;
} }
+ (FVPTextureMessage *)fromList:(NSArray *)list { + (FVPTextureMessage *)fromList:(NSArray *)list {
FVPTextureMessage *pigeonResult = [[FVPTextureMessage alloc] init]; FVPTextureMessage *pigeonResult = [[FVPTextureMessage alloc] init];
pigeonResult.textureId = GetNullableObjectAtIndex(list, 0); pigeonResult.textureId = [GetNullableObjectAtIndex(list, 0) integerValue];
NSAssert(pigeonResult.textureId != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPTextureMessage *)nullableFromList:(NSArray *)list { + (nullable FVPTextureMessage *)nullableFromList:(NSArray *)list {
@ -88,13 +87,13 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.textureId ?: [NSNull null]), @(self.textureId),
]; ];
} }
@end @end
@implementation FVPLoopingMessage @implementation FVPLoopingMessage
+ (instancetype)makeWithTextureId:(NSNumber *)textureId isLooping:(NSNumber *)isLooping { + (instancetype)makeWithTextureId:(NSInteger)textureId isLooping:(BOOL)isLooping {
FVPLoopingMessage *pigeonResult = [[FVPLoopingMessage alloc] init]; FVPLoopingMessage *pigeonResult = [[FVPLoopingMessage alloc] init];
pigeonResult.textureId = textureId; pigeonResult.textureId = textureId;
pigeonResult.isLooping = isLooping; pigeonResult.isLooping = isLooping;
@ -102,10 +101,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
+ (FVPLoopingMessage *)fromList:(NSArray *)list { + (FVPLoopingMessage *)fromList:(NSArray *)list {
FVPLoopingMessage *pigeonResult = [[FVPLoopingMessage alloc] init]; FVPLoopingMessage *pigeonResult = [[FVPLoopingMessage alloc] init];
pigeonResult.textureId = GetNullableObjectAtIndex(list, 0); pigeonResult.textureId = [GetNullableObjectAtIndex(list, 0) integerValue];
NSAssert(pigeonResult.textureId != nil, @""); pigeonResult.isLooping = [GetNullableObjectAtIndex(list, 1) boolValue];
pigeonResult.isLooping = GetNullableObjectAtIndex(list, 1);
NSAssert(pigeonResult.isLooping != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPLoopingMessage *)nullableFromList:(NSArray *)list { + (nullable FVPLoopingMessage *)nullableFromList:(NSArray *)list {
@ -113,14 +110,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.textureId ?: [NSNull null]), @(self.textureId),
(self.isLooping ?: [NSNull null]), @(self.isLooping),
]; ];
} }
@end @end
@implementation FVPVolumeMessage @implementation FVPVolumeMessage
+ (instancetype)makeWithTextureId:(NSNumber *)textureId volume:(NSNumber *)volume { + (instancetype)makeWithTextureId:(NSInteger)textureId volume:(double)volume {
FVPVolumeMessage *pigeonResult = [[FVPVolumeMessage alloc] init]; FVPVolumeMessage *pigeonResult = [[FVPVolumeMessage alloc] init];
pigeonResult.textureId = textureId; pigeonResult.textureId = textureId;
pigeonResult.volume = volume; pigeonResult.volume = volume;
@ -128,10 +125,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
+ (FVPVolumeMessage *)fromList:(NSArray *)list { + (FVPVolumeMessage *)fromList:(NSArray *)list {
FVPVolumeMessage *pigeonResult = [[FVPVolumeMessage alloc] init]; FVPVolumeMessage *pigeonResult = [[FVPVolumeMessage alloc] init];
pigeonResult.textureId = GetNullableObjectAtIndex(list, 0); pigeonResult.textureId = [GetNullableObjectAtIndex(list, 0) integerValue];
NSAssert(pigeonResult.textureId != nil, @""); pigeonResult.volume = [GetNullableObjectAtIndex(list, 1) doubleValue];
pigeonResult.volume = GetNullableObjectAtIndex(list, 1);
NSAssert(pigeonResult.volume != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPVolumeMessage *)nullableFromList:(NSArray *)list { + (nullable FVPVolumeMessage *)nullableFromList:(NSArray *)list {
@ -139,14 +134,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.textureId ?: [NSNull null]), @(self.textureId),
(self.volume ?: [NSNull null]), @(self.volume),
]; ];
} }
@end @end
@implementation FVPPlaybackSpeedMessage @implementation FVPPlaybackSpeedMessage
+ (instancetype)makeWithTextureId:(NSNumber *)textureId speed:(NSNumber *)speed { + (instancetype)makeWithTextureId:(NSInteger)textureId speed:(double)speed {
FVPPlaybackSpeedMessage *pigeonResult = [[FVPPlaybackSpeedMessage alloc] init]; FVPPlaybackSpeedMessage *pigeonResult = [[FVPPlaybackSpeedMessage alloc] init];
pigeonResult.textureId = textureId; pigeonResult.textureId = textureId;
pigeonResult.speed = speed; pigeonResult.speed = speed;
@ -154,10 +149,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
+ (FVPPlaybackSpeedMessage *)fromList:(NSArray *)list { + (FVPPlaybackSpeedMessage *)fromList:(NSArray *)list {
FVPPlaybackSpeedMessage *pigeonResult = [[FVPPlaybackSpeedMessage alloc] init]; FVPPlaybackSpeedMessage *pigeonResult = [[FVPPlaybackSpeedMessage alloc] init];
pigeonResult.textureId = GetNullableObjectAtIndex(list, 0); pigeonResult.textureId = [GetNullableObjectAtIndex(list, 0) integerValue];
NSAssert(pigeonResult.textureId != nil, @""); pigeonResult.speed = [GetNullableObjectAtIndex(list, 1) doubleValue];
pigeonResult.speed = GetNullableObjectAtIndex(list, 1);
NSAssert(pigeonResult.speed != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPPlaybackSpeedMessage *)nullableFromList:(NSArray *)list { + (nullable FVPPlaybackSpeedMessage *)nullableFromList:(NSArray *)list {
@ -165,14 +158,14 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.textureId ?: [NSNull null]), @(self.textureId),
(self.speed ?: [NSNull null]), @(self.speed),
]; ];
} }
@end @end
@implementation FVPPositionMessage @implementation FVPPositionMessage
+ (instancetype)makeWithTextureId:(NSNumber *)textureId position:(NSNumber *)position { + (instancetype)makeWithTextureId:(NSInteger)textureId position:(NSInteger)position {
FVPPositionMessage *pigeonResult = [[FVPPositionMessage alloc] init]; FVPPositionMessage *pigeonResult = [[FVPPositionMessage alloc] init];
pigeonResult.textureId = textureId; pigeonResult.textureId = textureId;
pigeonResult.position = position; pigeonResult.position = position;
@ -180,10 +173,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
+ (FVPPositionMessage *)fromList:(NSArray *)list { + (FVPPositionMessage *)fromList:(NSArray *)list {
FVPPositionMessage *pigeonResult = [[FVPPositionMessage alloc] init]; FVPPositionMessage *pigeonResult = [[FVPPositionMessage alloc] init];
pigeonResult.textureId = GetNullableObjectAtIndex(list, 0); pigeonResult.textureId = [GetNullableObjectAtIndex(list, 0) integerValue];
NSAssert(pigeonResult.textureId != nil, @""); pigeonResult.position = [GetNullableObjectAtIndex(list, 1) integerValue];
pigeonResult.position = GetNullableObjectAtIndex(list, 1);
NSAssert(pigeonResult.position != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPPositionMessage *)nullableFromList:(NSArray *)list { + (nullable FVPPositionMessage *)nullableFromList:(NSArray *)list {
@ -191,8 +182,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.textureId ?: [NSNull null]), @(self.textureId),
(self.position ?: [NSNull null]), @(self.position),
]; ];
} }
@end @end
@ -218,7 +209,6 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
pigeonResult.packageName = GetNullableObjectAtIndex(list, 2); pigeonResult.packageName = GetNullableObjectAtIndex(list, 2);
pigeonResult.formatHint = GetNullableObjectAtIndex(list, 3); pigeonResult.formatHint = GetNullableObjectAtIndex(list, 3);
pigeonResult.httpHeaders = GetNullableObjectAtIndex(list, 4); pigeonResult.httpHeaders = GetNullableObjectAtIndex(list, 4);
NSAssert(pigeonResult.httpHeaders != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPCreateMessage *)nullableFromList:(NSArray *)list { + (nullable FVPCreateMessage *)nullableFromList:(NSArray *)list {
@ -226,25 +216,24 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.asset ?: [NSNull null]), self.asset ?: [NSNull null],
(self.uri ?: [NSNull null]), self.uri ?: [NSNull null],
(self.packageName ?: [NSNull null]), self.packageName ?: [NSNull null],
(self.formatHint ?: [NSNull null]), self.formatHint ?: [NSNull null],
(self.httpHeaders ?: [NSNull null]), self.httpHeaders ?: [NSNull null],
]; ];
} }
@end @end
@implementation FVPMixWithOthersMessage @implementation FVPMixWithOthersMessage
+ (instancetype)makeWithMixWithOthers:(NSNumber *)mixWithOthers { + (instancetype)makeWithMixWithOthers:(BOOL)mixWithOthers {
FVPMixWithOthersMessage *pigeonResult = [[FVPMixWithOthersMessage alloc] init]; FVPMixWithOthersMessage *pigeonResult = [[FVPMixWithOthersMessage alloc] init];
pigeonResult.mixWithOthers = mixWithOthers; pigeonResult.mixWithOthers = mixWithOthers;
return pigeonResult; return pigeonResult;
} }
+ (FVPMixWithOthersMessage *)fromList:(NSArray *)list { + (FVPMixWithOthersMessage *)fromList:(NSArray *)list {
FVPMixWithOthersMessage *pigeonResult = [[FVPMixWithOthersMessage alloc] init]; FVPMixWithOthersMessage *pigeonResult = [[FVPMixWithOthersMessage alloc] init];
pigeonResult.mixWithOthers = GetNullableObjectAtIndex(list, 0); pigeonResult.mixWithOthers = [GetNullableObjectAtIndex(list, 0) boolValue];
NSAssert(pigeonResult.mixWithOthers != nil, @"");
return pigeonResult; return pigeonResult;
} }
+ (nullable FVPMixWithOthersMessage *)nullableFromList:(NSArray *)list { + (nullable FVPMixWithOthersMessage *)nullableFromList:(NSArray *)list {
@ -252,7 +241,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
} }
- (NSArray *)toList { - (NSArray *)toList {
return @[ return @[
(self.mixWithOthers ?: [NSNull null]), @(self.mixWithOthers),
]; ];
} }
@end @end
@ -335,7 +324,7 @@ NSObject<FlutterMessageCodec> *FVPAVFoundationVideoPlayerApiGetCodec(void) {
return sSharedObject; return sSharedObject;
} }
void FVPAVFoundationVideoPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, void SetUpFVPAVFoundationVideoPlayerApi(id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FVPAVFoundationVideoPlayerApi> *api) { NSObject<FVPAVFoundationVideoPlayerApi> *api) {
{ {
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]

View File

@ -141,7 +141,7 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error]; FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertNotNil(textureMessage); XCTAssertNotNil(textureMessage);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureMessage.textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureMessage.textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
XCTAssertNotNil(player.playerLayer, @"AVPlayerLayer should be present."); XCTAssertNotNil(player.playerLayer, @"AVPlayerLayer should be present.");
@ -169,18 +169,18 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
httpHeaders:@{}]; httpHeaders:@{}];
FlutterError *createError; FlutterError *createError;
FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&createError]; FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&createError];
NSNumber *textureId = textureMessage.textureId; NSInteger textureId = textureMessage.textureId;
XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"seekTo completes"]; XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"seekTo completes"];
FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:@1234]; FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:1234];
[videoPlayerPlugin seekTo:message [videoPlayerPlugin seekTo:message
completion:^(FlutterError *_Nullable error) { completion:^(FlutterError *_Nullable error) {
[initializedExpectation fulfill]; [initializedExpectation fulfill];
}]; }];
[self waitForExpectationsWithTimeout:30.0 handler:nil]; [self waitForExpectationsWithTimeout:30.0 handler:nil];
OCMVerify([mockTextureRegistry textureFrameAvailable:message.textureId.intValue]); OCMVerify([mockTextureRegistry textureFrameAvailable:message.textureId]);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureId)];
XCTAssertEqual([player position], 1234); XCTAssertEqual([player position], 1234);
} }
@ -203,7 +203,7 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error]; FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertNotNil(textureMessage); XCTAssertNotNil(textureMessage);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureMessage.textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureMessage.textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
AVPlayer *avPlayer = player.player; AVPlayer *avPlayer = player.player;
@ -234,7 +234,7 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error]; FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertNotNil(textureMessage); XCTAssertNotNil(textureMessage);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureMessage.textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureMessage.textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
AVPlayer *avPlayer = player.player; AVPlayer *avPlayer = player.player;
[avPlayer play]; [avPlayer play];
@ -340,11 +340,11 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
httpHeaders:@{}]; httpHeaders:@{}];
FlutterError *createError; FlutterError *createError;
FVPTextureMessage *textureMessage = [pluginWithMockAVPlayer create:create error:&createError]; FVPTextureMessage *textureMessage = [pluginWithMockAVPlayer create:create error:&createError];
NSNumber *textureId = textureMessage.textureId; NSInteger textureId = textureMessage.textureId;
XCTestExpectation *initializedExpectation = XCTestExpectation *initializedExpectation =
[self expectationWithDescription:@"seekTo has zero tolerance when seeking not to end"]; [self expectationWithDescription:@"seekTo has zero tolerance when seeking not to end"];
FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:@1234]; FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:1234];
[pluginWithMockAVPlayer seekTo:message [pluginWithMockAVPlayer seekTo:message
completion:^(FlutterError *_Nullable error) { completion:^(FlutterError *_Nullable error) {
[initializedExpectation fulfill]; [initializedExpectation fulfill];
@ -377,12 +377,12 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
httpHeaders:@{}]; httpHeaders:@{}];
FlutterError *createError; FlutterError *createError;
FVPTextureMessage *textureMessage = [pluginWithMockAVPlayer create:create error:&createError]; FVPTextureMessage *textureMessage = [pluginWithMockAVPlayer create:create error:&createError];
NSNumber *textureId = textureMessage.textureId; NSInteger textureId = textureMessage.textureId;
XCTestExpectation *initializedExpectation = XCTestExpectation *initializedExpectation =
[self expectationWithDescription:@"seekTo has non-zero tolerance when seeking to end"]; [self expectationWithDescription:@"seekTo has non-zero tolerance when seeking to end"];
// The duration of this video is "0" due to the non standard initiliatazion process. // The duration of this video is "0" due to the non standard initiliatazion process.
FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:@0]; FVPPositionMessage *message = [FVPPositionMessage makeWithTextureId:textureId position:0];
[pluginWithMockAVPlayer seekTo:message [pluginWithMockAVPlayer seekTo:message
completion:^(FlutterError *_Nullable error) { completion:^(FlutterError *_Nullable error) {
[initializedExpectation fulfill]; [initializedExpectation fulfill];
@ -405,8 +405,8 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
httpHeaders:@{}]; httpHeaders:@{}];
FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error]; FVPTextureMessage *textureMessage = [videoPlayerPlugin create:create error:&error];
NSNumber *textureId = textureMessage.textureId; NSInteger textureId = textureMessage.textureId;
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"initialized"]; XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"initialized"];
@ -428,15 +428,14 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
XCTAssertEqual(avPlayer.timeControlStatus, AVPlayerTimeControlStatusPaused); XCTAssertEqual(avPlayer.timeControlStatus, AVPlayerTimeControlStatusPaused);
// Change playback speed. // Change playback speed.
FVPPlaybackSpeedMessage *playback = [FVPPlaybackSpeedMessage makeWithTextureId:textureId FVPPlaybackSpeedMessage *playback = [FVPPlaybackSpeedMessage makeWithTextureId:textureId speed:2];
speed:@2];
[videoPlayerPlugin setPlaybackSpeed:playback error:&error]; [videoPlayerPlugin setPlaybackSpeed:playback error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertEqual(avPlayer.rate, 2); XCTAssertEqual(avPlayer.rate, 2);
XCTAssertEqual(avPlayer.timeControlStatus, AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate); XCTAssertEqual(avPlayer.timeControlStatus, AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate);
// Volume // Volume
FVPVolumeMessage *volume = [FVPVolumeMessage makeWithTextureId:textureId volume:@0.1]; FVPVolumeMessage *volume = [FVPVolumeMessage makeWithTextureId:textureId volume:0.1];
[videoPlayerPlugin setVolume:volume error:&error]; [videoPlayerPlugin setVolume:volume error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertEqual(avPlayer.volume, 0.1f); XCTAssertEqual(avPlayer.volume, 0.1f);
@ -476,7 +475,7 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertNotNil(textureMessage); XCTAssertNotNil(textureMessage);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureMessage.textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureMessage.textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
weakPlayer = player; weakPlayer = player;
avPlayer = player.player; avPlayer = player.player;
@ -530,7 +529,7 @@ NSObject<FlutterPluginRegistry> *GetPluginRegistry(void) {
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertNotNil(textureMessage); XCTAssertNotNil(textureMessage);
FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[textureMessage.textureId]; FVPVideoPlayer *player = videoPlayerPlugin.playersByTextureId[@(textureMessage.textureId)];
XCTAssertNotNil(player); XCTAssertNotNil(player);
weakPlayer = player; weakPlayer = player;

View File

@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly. // Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
@ -11,6 +11,17 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
List<Object?> wrapResponse(
{Object? result, PlatformException? error, bool empty = false}) {
if (empty) {
return <Object?>[];
}
if (error == null) {
return <Object?>[result];
}
return <Object?>[error.code, error.message, error.details];
}
class TextureMessage { class TextureMessage {
TextureMessage({ TextureMessage({
required this.textureId, required this.textureId,

View File

@ -7,8 +7,8 @@ import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(PigeonOptions( @ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/messages.g.dart', dartOut: 'lib/src/messages.g.dart',
dartTestOut: 'test/test_api.g.dart', dartTestOut: 'test/test_api.g.dart',
objcHeaderOut: 'ios/Classes/messages.g.h', objcHeaderOut: 'darwin/Classes/messages.g.h',
objcSourceOut: 'ios/Classes/messages.g.m', objcSourceOut: 'darwin/Classes/messages.g.m',
objcOptions: ObjcOptions( objcOptions: ObjcOptions(
prefix: 'FVP', prefix: 'FVP',
), ),

View File

@ -2,7 +2,7 @@ name: video_player_avfoundation
description: iOS and macOS implementation of the video_player plugin. description: iOS and macOS implementation of the video_player plugin.
repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.5.0 version: 2.5.1
environment: environment:
sdk: ">=3.1.0 <4.0.0" sdk: ">=3.1.0 <4.0.0"
@ -29,7 +29,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pigeon: ^11.0.1 pigeon: ^13.0.0
topics: topics:
- video - video

View File

@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved. // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly. // Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon // See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
// ignore_for_file: avoid_relative_lib_imports // ignore_for_file: avoid_relative_lib_imports
@ -107,9 +107,15 @@ abstract class TestHostVideoPlayerApi {
_testBinaryMessengerBinding!.defaultBinaryMessenger _testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(channel, .setMockDecodedMessageHandler<Object?>(channel,
(Object? message) async { (Object? message) async {
// ignore message try {
api.initialize(); api.initialize();
return <Object?>[]; return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -131,8 +137,15 @@ abstract class TestHostVideoPlayerApi {
final CreateMessage? arg_msg = (args[0] as CreateMessage?); final CreateMessage? arg_msg = (args[0] as CreateMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.create was null, expected non-null CreateMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.create was null, expected non-null CreateMessage.');
final TextureMessage output = api.create(arg_msg!); try {
return <Object?>[output]; final TextureMessage output = api.create(arg_msg!);
return <Object?>[output];
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -154,8 +167,15 @@ abstract class TestHostVideoPlayerApi {
final TextureMessage? arg_msg = (args[0] as TextureMessage?); final TextureMessage? arg_msg = (args[0] as TextureMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.dispose was null, expected non-null TextureMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.dispose was null, expected non-null TextureMessage.');
api.dispose(arg_msg!); try {
return <Object?>[]; api.dispose(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -177,8 +197,15 @@ abstract class TestHostVideoPlayerApi {
final LoopingMessage? arg_msg = (args[0] as LoopingMessage?); final LoopingMessage? arg_msg = (args[0] as LoopingMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setLooping was null, expected non-null LoopingMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setLooping was null, expected non-null LoopingMessage.');
api.setLooping(arg_msg!); try {
return <Object?>[]; api.setLooping(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -200,8 +227,15 @@ abstract class TestHostVideoPlayerApi {
final VolumeMessage? arg_msg = (args[0] as VolumeMessage?); final VolumeMessage? arg_msg = (args[0] as VolumeMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setVolume was null, expected non-null VolumeMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setVolume was null, expected non-null VolumeMessage.');
api.setVolume(arg_msg!); try {
return <Object?>[]; api.setVolume(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -224,8 +258,15 @@ abstract class TestHostVideoPlayerApi {
(args[0] as PlaybackSpeedMessage?); (args[0] as PlaybackSpeedMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setPlaybackSpeed was null, expected non-null PlaybackSpeedMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setPlaybackSpeed was null, expected non-null PlaybackSpeedMessage.');
api.setPlaybackSpeed(arg_msg!); try {
return <Object?>[]; api.setPlaybackSpeed(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -247,8 +288,15 @@ abstract class TestHostVideoPlayerApi {
final TextureMessage? arg_msg = (args[0] as TextureMessage?); final TextureMessage? arg_msg = (args[0] as TextureMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.play was null, expected non-null TextureMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.play was null, expected non-null TextureMessage.');
api.play(arg_msg!); try {
return <Object?>[]; api.play(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -270,8 +318,15 @@ abstract class TestHostVideoPlayerApi {
final TextureMessage? arg_msg = (args[0] as TextureMessage?); final TextureMessage? arg_msg = (args[0] as TextureMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.position was null, expected non-null TextureMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.position was null, expected non-null TextureMessage.');
final PositionMessage output = api.position(arg_msg!); try {
return <Object?>[output]; final PositionMessage output = api.position(arg_msg!);
return <Object?>[output];
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -293,8 +348,15 @@ abstract class TestHostVideoPlayerApi {
final PositionMessage? arg_msg = (args[0] as PositionMessage?); final PositionMessage? arg_msg = (args[0] as PositionMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.seekTo was null, expected non-null PositionMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.seekTo was null, expected non-null PositionMessage.');
await api.seekTo(arg_msg!); try {
return <Object?>[]; await api.seekTo(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -316,8 +378,15 @@ abstract class TestHostVideoPlayerApi {
final TextureMessage? arg_msg = (args[0] as TextureMessage?); final TextureMessage? arg_msg = (args[0] as TextureMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.pause was null, expected non-null TextureMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.pause was null, expected non-null TextureMessage.');
api.pause(arg_msg!); try {
return <Object?>[]; api.pause(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }
@ -340,8 +409,15 @@ abstract class TestHostVideoPlayerApi {
(args[0] as MixWithOthersMessage?); (args[0] as MixWithOthersMessage?);
assert(arg_msg != null, assert(arg_msg != null,
'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setMixWithOthers was null, expected non-null MixWithOthersMessage.'); 'Argument for dev.flutter.pigeon.video_player_avfoundation.AVFoundationVideoPlayerApi.setMixWithOthers was null, expected non-null MixWithOthersMessage.');
api.setMixWithOthers(arg_msg!); try {
return <Object?>[]; api.setMixWithOthers(arg_msg!);
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
}); });
} }
} }