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

Conversation

@danielroek
Copy link
Contributor

Description

Implements the changes of #1743 with the desired changes to the implementation. This makes it possible (again) to stream HLS stream with an indefinite length.

On an iPhone simulator I only hear the audio when playing a HLS stream, but running it on an iPad everything works.

I added some checks to the VideoProgressIndicator. On iOS, because the duration is 0, it's going to divide 0 by 0, which results in a crash. This is not an issue in Android. On iOS the ProgressIndicator now just shows no progress, which I believe should be the desired behaviour.

Related Issues

#1743
Fixes #48670

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@danielroek danielroek changed the title Fixed HLS streams on iOS (#48760) [video_player] Fixed HLS streams on iOS (#48760) Sep 21, 2020
@mvanbeusekom
Copy link
Contributor

Rebase with master and resolve conflicting version number

@danielroek
Copy link
Contributor Author

Rebase with master and resolve conflicting version number

@mvanbeusekom Done

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

Thanks! left a few comments

children: <Widget>[
LinearProgressIndicator(
value: maxBuffering / duration,
value: duration > 0 ? maxBuffering / duration : 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to cover the crashy behavior with a test?

children: <Widget>[
LinearProgressIndicator(
value: maxBuffering / duration,
value: duration > 0 ? maxBuffering / duration : 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does duration 0 means it's indefinite? if so should we use null for value to show an indefinite progress indicator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's 0 on iOS. Android returns different values

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have an indication on Android that it's indefinite? what does the progress bar show for indefinite streams on Android?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exoPlayer does have a isDynamic function on the Window. This is set to true when a Live stream is being played. I believe this would be the best solution. Link to the docs..

I could implement a VideoPlayerController().isDurationIndefinite getter that returns true when ExoPlayer returns true on the isDynamic getter on Android, and when isDurationIndefinite returns true on iOS?


// The player may be initialized but still needs to determine the duration.
if ([self duration] == 0) {
if ([self duration] == 0 && ![self isDurationIndefinite]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@cyanglaz any hints on how to test cover this?

@danielroek danielroek closed this Oct 1, 2020
@danielroek danielroek deleted the issue-48760 branch October 1, 2020 11:21
mciekurs2 pushed a commit to mciekurs2/plugins that referenced this pull request Jan 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter video_player unable to play HLS live video on iOS device

4 participants