Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.8.9

* Improves compatibility with `UIScene`.
* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

## 2.8.8

* Refactors Dart internals for maintainability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,30 @@ - (void)seekToTime:(CMTime)time

@end

// Convience to avoid having two copies of the StubViewProvider code.
#if TARGET_OS_OSX
#define PROVIDED_VIEW_TYPE NSView
@interface StubViewProvider : NSObject <FVPViewProvider>
#if TARGET_OS_IOS
- (instancetype)initWithViewController:(UIViewController *)viewController;
@property(nonatomic, nullable) UIViewController *viewController;
#else
#define PROVIDED_VIEW_TYPE UIView
- (instancetype)initWithView:(NSView *)view;
@property(nonatomic, nullable) NSView *view;
#endif

@interface StubViewProvider : NSObject <FVPViewProvider>
- (instancetype)initWithView:(PROVIDED_VIEW_TYPE *)view;
@property(nonatomic, nullable) PROVIDED_VIEW_TYPE *view;
@end

@implementation StubViewProvider
- (instancetype)initWithView:(PROVIDED_VIEW_TYPE *)view {
#if TARGET_OS_IOS
- (instancetype)initWithViewController:(UIViewController *)viewController {
self = [super init];
_viewController = viewController;
return self;
}
#else
- (instancetype)initWithView:(NSView *)view {
self = [super init];
_view = view;
return self;
}
#endif
@end

@interface StubFVPAVFactory : NSObject <FVPAVFactory>
Expand Down Expand Up @@ -227,14 +233,19 @@ - (void)testBlankVideoBugWithEncryptedVideoStreamAndInvertedAspectRatioBugForSom
#if TARGET_OS_OSX
NSView *view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 10, 10)];
view.wantsLayer = true;
id<FVPViewProvider> viewProvider = [[StubViewProvider alloc] initWithView:view];
#else
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view = view;
id<FVPViewProvider> viewProvider =
[[StubViewProvider alloc] initWithViewController:viewController];
#endif
NSObject<FlutterPluginRegistrar> *registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:nil]
displayLinkFactory:nil
viewProvider:[[StubViewProvider alloc] initWithView:view]
viewProvider:viewProvider
registrar:registrar];

FlutterError *error;
Expand Down Expand Up @@ -267,7 +278,7 @@ - (void)testPlayerForPlatformViewDoesNotRegisterTexture {
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *initializationError;
Expand All @@ -294,7 +305,7 @@ - (void)testSeekToWhilePausedStartsDisplayLinkTemporarily {
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *initializationError;
Expand Down Expand Up @@ -351,7 +362,7 @@ - (void)testInitStartsDisplayLinkTemporarily {
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:stubAVPlayer
output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *initializationError;
Expand Down Expand Up @@ -397,7 +408,7 @@ - (void)testSeekToWhilePlayingDoesNotStopDisplayLink {
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *initializationError;
Expand Down Expand Up @@ -452,7 +463,7 @@ - (void)testPauseWhileWaitingForFrameDoesNotStopDisplayLink {
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *initializationError;
Expand Down Expand Up @@ -605,7 +616,7 @@ - (void)testSeekToleranceWhenNotSeekingToEnd {
FVPVideoPlayer *player =
[[FVPVideoPlayer alloc] initWithPlayerItem:[self playerItemWithURL:self.mp4TestURL]
avFactory:stubAVFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]];
viewProvider:[[StubViewProvider alloc] init]];
NSObject<FVPVideoEventListener> *listener = OCMProtocolMock(@protocol(FVPVideoEventListener));
player.eventListener = listener;

Expand All @@ -628,7 +639,7 @@ - (void)testSeekToleranceWhenSeekingToEnd {
FVPVideoPlayer *player =
[[FVPVideoPlayer alloc] initWithPlayerItem:[self playerItemWithURL:self.mp4TestURL]
avFactory:stubAVFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]];
viewProvider:[[StubViewProvider alloc] init]];
NSObject<FVPVideoEventListener> *listener = OCMProtocolMock(@protocol(FVPVideoEventListener));
player.eventListener = listener;

Expand All @@ -654,7 +665,7 @@ - (StubEventListener *)sanityTestURI:(NSString *)testURI {
FVPVideoPlayer *player =
[[FVPVideoPlayer alloc] initWithPlayerItem:[self playerItemWithURL:testURL]
avFactory:[[FVPDefaultAVFactory alloc] init]
viewProvider:[[StubViewProvider alloc] initWithView:nil]];
viewProvider:[[StubViewProvider alloc] init]];
XCTAssertNotNil(player);

XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"initialized"];
Expand Down Expand Up @@ -850,7 +861,7 @@ - (void)testUpdatePlayingStateShouldNotResetRate {
FVPVideoPlayer *player = [[FVPVideoPlayer alloc]
initWithPlayerItem:[self playerItemWithURL:self.mp4TestURL]
avFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:nil]
viewProvider:[[StubViewProvider alloc] initWithView:nil]];
viewProvider:[[StubViewProvider alloc] init]];

XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"initialized"];
StubEventListener *listener =
Expand All @@ -875,7 +886,7 @@ - (void)testPlayerShouldNotDropEverySecondFrame {
FVPVideoPlayerPlugin *videoPlayerPlugin = [[FVPVideoPlayerPlugin alloc]
initWithAVFactory:[[StubFVPAVFactory alloc] initWithPlayer:nil output:mockVideoOutput]
displayLinkFactory:stubDisplayLinkFactory
viewProvider:[[StubViewProvider alloc] initWithView:nil]
viewProvider:[[StubViewProvider alloc] init]
registrar:registrar];

FlutterError *error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ - (instancetype)initWithPlayerItem:(AVPlayerItem *)item
// invisible AVPlayerLayer is used to overwrite the protection of pixel buffers in those streams
// for issue #1, and restore the correct width and height for issue #2.
_playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
[viewProvider.view.layer addSublayer:self.playerLayer];
#if TARGET_OS_IOS
CALayer *flutterLayer = viewProvider.viewController.view.layer;
#else
CALayer *flutterLayer = viewProvider.view.layer;
#endif
[flutterLayer addSublayer:self.playerLayer];
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@ - (NSView *)view {
return self.registrar.view;
}
#else
- (UIView *)view {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// TODO(hellohuanlin): Provide a non-deprecated codepath. See
// https://github.com/flutter/flutter/issues/104117
UIViewController *root = UIApplication.sharedApplication.keyWindow.rootViewController;
#pragma clang diagnostic pop
return root.view;
- (UIViewController *)viewController {
return self.registrar.viewController;
}
#endif
@end
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
/// The view containing the Flutter content.
@property(nonatomic, readonly, nullable) NSView *view;
#else
/// The view containing the Flutter content.
@property(nonatomic, readonly, nullable) UIView *view;
/// The view controller containing the Flutter content.
@property(nonatomic, readonly, nullable) UIViewController *viewController;
#endif
@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: Demonstrates how to use the video_player plugin.
publish_to: none

environment:
sdk: ^3.9.0
flutter: ">=3.35.0"
sdk: ^3.10.0
flutter: ">=3.38.0"

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: video_player_avfoundation
description: iOS and macOS implementation of the video_player plugin.
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
version: 2.8.8
version: 2.8.9

environment:
sdk: ^3.9.0
flutter: ">=3.35.0"
sdk: ^3.10.0
flutter: ">=3.38.0"

flutter:
plugin:
Expand Down