-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[video_player] #60048 ios picture in picture #3500
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 1 commit
595d3df
4831f57
976b630
a7d5dd5
876dfe8
a4ca9e7
49f769a
5477f0b
0764e27
65fdf65
d4d9ff9
ff6d02f
ae7500a
4eeb6e1
9110d0f
211c6b3
5a8735b
4583229
70284aa
7289998
ee96f77
da13c09
4d83a52
ac920fe
8394840
19b1440
1963d27
f71a27a
b3e05a0
1325254
72ba79a
8c67ab8
f935a16
42a7815
fa93319
b0103d0
236ab51
1cf961d
5c18256
ddc7139
45494b9
0597f32
5c1f759
e94ccaa
9dc85a0
2b72605
601c506
4574fa9
1135695
cd7fede
e9aba08
30c0b7a
c0ccbfc
8ee1dcb
58db59a
16ae8cb
a15c3b7
87b92c2
5183028
002faa0
148cd55
d88cf33
45f96f5
9459bd5
d9f883b
c9993dc
3e401c1
b250e9c
01aaf8d
ee6db47
2e3196b
29c1d3b
6d8fb1e
114f5b8
5861e1d
114f9ac
3c1b4e6
3985a77
1649be4
bc56139
e1348c8
7e70da0
4abe6f1
2006494
58dabf4
881e80e
917bdd4
fba55da
b0f42d8
e0231d8
c58b722
376bcf5
5dd6e13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
# Conflicts: # packages/video_player/video_player/CHANGELOG.md # packages/video_player/video_player_avfoundation/CHANGELOG.md # packages/video_player/video_player_avfoundation/darwin/Classes/FVPVideoPlayerPlugin.m # packages/video_player/video_player_avfoundation/pubspec.yaml # packages/video_player/video_player_platform_interface/CHANGELOG.md
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,17 +84,10 @@ - (FVPDisplayLink *)displayLinkWithRegistrar:(id<FlutterPluginRegistrar>)registr | |
|
|
||
| @end | ||
|
|
||
| @interface FVPVideoPlayer | ||
| : NSObject <FlutterTexture, FlutterStreamHandler, AVPictureInPictureControllerDelegate> | ||
| @property(readonly, nonatomic) AVPlayer *player; | ||
| #pragma mark - | ||
|
|
||
| @interface FVPVideoPlayer () <AVPictureInPictureControllerDelegate> | ||
| @property(readonly, nonatomic) AVPlayerItemVideoOutput *videoOutput; | ||
| // This is to fix 2 bugs: 1. blank video for encrypted video streams on iOS 16 | ||
| // (https://github.com/flutter/flutter/issues/111457) and 2. swapped width and height for some video | ||
| // streams (not just iOS 16). (https://github.com/flutter/flutter/issues/109116). | ||
| // An 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. | ||
| // It is also used to start picture-in-picture | ||
| @property(readonly, nonatomic) AVPlayerLayer *playerLayer; | ||
| @property(nonatomic) AVPictureInPictureController *pictureInPictureController; | ||
| // The plugin registrar, to obtain view information from. | ||
| @property(nonatomic, weak) NSObject<FlutterPluginRegistrar> *registrar; | ||
|
|
@@ -108,16 +101,14 @@ @interface FVPVideoPlayer | |
| @property(nonatomic) BOOL isLooping; | ||
| @property(nonatomic, readonly) BOOL isInitialized; | ||
| @property(nonatomic) BOOL isPictureInPictureStarted; | ||
|
||
| // TODO(stuartmorgan): Extract and abstract the display link to remove all the display-link-related | ||
| // ifdefs from this file. | ||
| #if TARGET_OS_OSX | ||
| // The display link to trigger frame reads from the video player. | ||
| @property(nonatomic, assign) CVDisplayLinkRef displayLink; | ||
| // A dispatch source to move display link callbacks to the main thread. | ||
| @property(nonatomic, strong) dispatch_source_t displayLinkSource; | ||
| #else | ||
| @property(nonatomic) CADisplayLink *displayLink; | ||
| #endif | ||
| // The updater that drives callbacks to the engine to indicate that a new frame is ready. | ||
| @property(nonatomic) FVPFrameUpdater *frameUpdater; | ||
| // The display link that drives frameUpdater. | ||
| @property(nonatomic) FVPDisplayLink *displayLink; | ||
| // Whether a new frame needs to be provided to the engine regardless of the current play/pause state | ||
| // (e.g., after a seek while paused). If YES, the display link should continue to run until the next | ||
| // frame is successfully provided. | ||
| @property(nonatomic, assign) BOOL waitingForFrame; | ||
|
|
||
| - (instancetype)initWithURL:(NSURL *)url | ||
| frameUpdater:(FVPFrameUpdater *)frameUpdater | ||
|
|
@@ -344,7 +335,18 @@ - (instancetype)initWithPlayerItem:(AVPlayerItem *)item | |
|
|
||
| [self setupPiPController]; | ||
|
||
|
|
||
| [self createVideoOutputAndDisplayLink:frameUpdater]; | ||
| // Configure output. | ||
| _displayLink = displayLink; | ||
| NSDictionary *pixBuffAttributes = @{ | ||
| (id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA), | ||
| (id)kCVPixelBufferIOSurfacePropertiesKey : @{} | ||
| }; | ||
| _videoOutput = [avFactory videoOutputWithPixelBufferAttributes:pixBuffAttributes]; | ||
| frameUpdater.videoOutput = _videoOutput; | ||
| #if TARGET_OS_IOS | ||
| // See TODO on this property in FVPFrameUpdater. | ||
| frameUpdater.skipBufferAvailabilityCheck = YES; | ||
| #endif | ||
|
|
||
| [self addObserversForItem:item player:_player]; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.