Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c1a7c0d

Browse files
committed
Review comments
1 parent d3b39ca commit c1a7c0d

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -269,7 +269,7 @@
269269
97C146E61CF9000F007C117D /* Project object */ = {
270270
isa = PBXProject;
271271
attributes = {
272-
LastUpgradeCheck = 1100;
272+
LastUpgradeCheck = 1300;
273273
ORGANIZATIONNAME = "The Flutter Authors";
274274
TargetAttributes = {
275275
97C146ED1CF9000F007C117D = {

packages/video_player/video_player/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1100"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,17 @@ - (void)observeValueForKeyPath:(NSString*)path
292292
break;
293293
case AVPlayerItemStatusReadyToPlay:
294294
[item addOutput:_videoOutput];
295-
[self sendInitialized];
295+
[self setupEventSinkIfReadyToPlay];
296296
[self updatePlayingState];
297297
break;
298298
}
299299
} else if (context == presentationSizeContext || context == durationContext) {
300300
AVPlayerItem* item = (AVPlayerItem*)object;
301301
if (item.status == AVPlayerItemStatusReadyToPlay) {
302-
// When the player item is ready, it still may not have determined its presentation size or
303-
// duration. When these properties are finally set, initialize the player.
304-
[self sendInitialized];
302+
// Due to an apparent bug, when the player item is ready, it still may not have determined
303+
// its presentation size or duration. When these properties are finally set, re-check if
304+
// all required properties and instantiate the event sink if it is not already set up.
305+
[self setupEventSinkIfReadyToPlay];
305306
[self updatePlayingState];
306307
}
307308
} else if (context == playbackLikelyToKeepUpContext) {
@@ -334,7 +335,7 @@ - (void)updatePlayingState {
334335
_displayLink.paused = !_isPlaying;
335336
}
336337

337-
- (void)sendInitialized {
338+
- (void)setupEventSinkIfReadyToPlay {
338339
if (_eventSink && !_isInitialized) {
339340
CGSize size = [self.player currentItem].presentationSize;
340341
CGFloat width = size.width;
@@ -443,7 +444,7 @@ - (FlutterError* _Nullable)onListenWithArguments:(id _Nullable)arguments
443444
// This line ensures the 'initialized' event is sent when the event
444445
// 'AVPlayerItemStatusReadyToPlay' fires before _eventSink is set (this function
445446
// onListenWithArguments is called)
446-
[self sendInitialized];
447+
[self setupEventSinkIfReadyToPlay];
447448
return nil;
448449
}
449450

0 commit comments

Comments
 (0)