-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[video_player] Wait to initialize m3u8 videos on iOS until size is set #4727
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| archiveVersion = 1; | ||
| classes = { | ||
| }; | ||
| objectVersion = 50; | ||
| objectVersion = 46; | ||
|
Contributor
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. Let Xcode touch the project. |
||
| objects = { | ||
|
|
||
| /* Begin PBXBuildFile section */ | ||
|
|
@@ -269,7 +269,7 @@ | |
| 97C146E61CF9000F007C117D /* Project object */ = { | ||
| isa = PBXProject; | ||
| attributes = { | ||
| LastUpgradeCheck = 1300; | ||
| LastUpgradeCheck = 1320; | ||
| ORGANIZATIONNAME = "The Flutter Authors"; | ||
| TargetAttributes = { | ||
| 97C146ED1CF9000F007C117D = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,22 @@ - (void)testAudioControls { | |
| XCTAssertEqualWithAccuracy([audioInitialization[@"duration"] intValue], 5400, 200); | ||
| } | ||
|
|
||
| - (void)testHlsControls { | ||
|
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.
Contributor
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. Done. |
||
| NSObject<FlutterPluginRegistry> *registry = | ||
| (NSObject<FlutterPluginRegistry> *)[[UIApplication sharedApplication] delegate]; | ||
| NSObject<FlutterPluginRegistrar> *registrar = [registry registrarForPlugin:@"TestHlsControls"]; | ||
|
|
||
| FLTVideoPlayerPlugin *videoPlayerPlugin = | ||
| (FLTVideoPlayerPlugin *)[[FLTVideoPlayerPlugin alloc] initWithRegistrar:registrar]; | ||
|
|
||
| NSDictionary<NSString *, id> *videoInitialization = | ||
| [self testPlugin:videoPlayerPlugin | ||
| uri:@"https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8"]; | ||
| XCTAssertEqualObjects(videoInitialization[@"height"], @720); | ||
| XCTAssertEqualObjects(videoInitialization[@"width"], @1280); | ||
| XCTAssertEqualWithAccuracy([videoInitialization[@"duration"] intValue], 4000, 200); | ||
| } | ||
|
|
||
| - (NSDictionary<NSString *, id> *)testPlugin:(FLTVideoPlayerPlugin *)videoPlayerPlugin | ||
| uri:(NSString *)uri { | ||
| FlutterError *error; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,9 +354,11 @@ - (void)setupEventSinkIfReadyToPlay { | |
| } | ||
|
|
||
| BOOL hasVideoTracks = [asset tracksWithMediaType:AVMediaTypeVideo].count != 0; | ||
| BOOL hasNoTracks = asset.tracks.count == 0; | ||
|
|
||
| // The player has not yet initialized when it contains video tracks. | ||
| if (hasVideoTracks && height == CGSizeZero.height && width == CGSizeZero.width) { | ||
| // The player has not yet initialized when it has no size, unless it is an audio-only track. | ||
| // HLS m3u8 video files never load any tracks, and are also not yet initialized until they have a size. | ||
|
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 possible that any other formats would suffer from this?
Contributor
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. Possibly, we have limited testing for the range of possible video types. |
||
| if ((hasVideoTracks || hasNoTracks) && height == CGSizeZero.height && width == CGSizeZero.width) { | ||
| return; | ||
| } | ||
| // The player may be initialized but still needs to determine the duration. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ name: video_player_avfoundation | |
| description: iOS implementation of the video_player plugin. | ||
| repository: https://github.com/flutter/plugins/tree/master/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.2.17 | ||
| version: 2.2.18 | ||
|
Contributor
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. @stuartmorgan is there anything else I need to do to version this federated plugin?
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. No, we don't push version changes through to the app-facing plugin; the expectation is that people are updating transitive dependencies. |
||
|
|
||
| environment: | ||
| sdk: ">=2.14.0 <3.0.0" | ||
|
|
||
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.
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.
Done.