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

[video_player] Wait to initialize m3u8 videos on iOS until size is set #4727

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Feb 3, 2022

#4639 introduced playing audio-only files with video_player, detected with [asset tracksWithMediaType:AVMediaTypeVideo]. Unfortunately HTTPS Live Streaming files (m3u8) are video files, but never load tracks. Allow initialization of "video" files with no tracks of any kind, AVMediaTypeVideo or otherwise.

Fixes flutter/flutter#97206
Test with flutter/assets-for-api-docs#178

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 46;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let Xcode touch the project.

@@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a CHANGELOG nit


* Wait to initialize m3u8 videos until size is set, fixing aspect ratio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Wait to initialize m3u8 videos until size is set, fixing aspect ratio
* Wait to initialize m3u8 videos until size is set, fixing aspect ratio.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that any other formats would suffer from this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, we have limited testing for the range of possible video types.
At least now it will be no different than before #4639 in terms of file formats that don't have tracks.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with naming nit

@@ -103,6 +103,22 @@ - (void)testAudioControls {
XCTAssertEqualWithAccuracy([audioInitialization[@"duration"] intValue], 5400, 200);
}

- (void)testHlsControls {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testHLSControls, since it's ObjC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: video_player platform-ios waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[video_player][iOS]: aspect ratio of m3u8 videos is different from .mp4 videos
4 participants