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

Conversation

@ianko
Copy link
Contributor

@ianko ianko commented Jun 13, 2019

Description

The 0.10.1 version introduced the condition to have the duration in order to consider the player initialized. That change made the live stream videos not able to play anymore, since it does not have a duration.

Related Issues

flutter/flutter#35402
flutter/flutter#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.

@collinjackson
Copy link
Contributor

Is there a better way to prevent the division by zero error that #1554 was trying to fix?

@iskakaushik @ened

@ianko
Copy link
Contributor Author

ianko commented Jun 17, 2019

@collinjackson Didn't know that the division by zero was the issue there. I will definitely work in a solution that solves both cases.

@collinjackson
Copy link
Contributor

@collinjackson Didn't know that the division by zero was the issue there. I will definitely work in a solution that solves both cases.

Great, thanks! Let me know when this PR is ready for re-review.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@collinjackson
Copy link
Contributor

Checking in, it looks like you're still working on this PR since the tests don't pass so I'm marking it WIP. Just let us know when it's ready for re-review. Thanks!

@ianko
Copy link
Contributor Author

ianko commented Jul 3, 2019

@collinjackson We have a working solution already.

Taking some time to fix the errors from the example app. Will be finished by tomorrow.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@bduyng
Copy link

bduyng commented Jul 5, 2019

@googlebot confirmed!

@ianko
Copy link
Contributor Author

ianko commented Jul 5, 2019

@collinjackson I am done with the PR.

Here are some things to notice:

  1. We have added a better validation for the duration in the VideoPlayerPlugin.m file;
  2. Better validation and checks in the video_player.dart;
  3. Added a Live tab in the example app;

When testing the example app, I've noticed that, everytime we switch to a tab that plays a video from the assets, an exception is thrown and the other videos start to play as well. This was not introduced by this PR. I went back and tested previous versions and it does the same.

I refactored the whole example app trying to find the source of the problem but it's not in it. It's something from the player itself and I couldn't find the reason. That's probably why there was a controller.setVolume(0.0) in the deactive() method. To hide the fact that the video was playing.

I am sending the PR with the refactored example app (all the features remain the same). I believe it's cleaner this way. Let me know what you think.

About the failing CLA: @bduyng is the co-author of this PR. He already signed the CLA and also sent a confirmation message here.

@cyanglaz
Copy link
Contributor

cyanglaz commented Jul 9, 2019

@ianko Thank you for the contribution. The PR seems pretty long and it includes different things. Do you mind to separate the refactor and the race condition fixing to different PRs?

@ianko
Copy link
Contributor Author

ianko commented Jul 10, 2019

@ianko Thank you for the contribution. The PR seems pretty long and it includes different things. Do you mind to separate the refactor and the race condition fixing to different PRs?

@cyanglaz,

It was already a different PR (#1562). I had to bring to try to fix the issue with the video from assets that I mentioned, but it does not solve this case.

Added a reference to a related issue flutter/flutter#35402 opened recently.

@cyanglaz
Copy link
Contributor

@ianko Thanks, this PR seems still contains multiple stuff: the duration method addition and a refactoring of the example app. Do you mind separate them so one PR only contains a single feature/fix?

@ianko ianko mentioned this pull request Jul 10, 2019
13 tasks
@ianko
Copy link
Contributor Author

ianko commented Jul 10, 2019

@cyanglaz Done.

#1562 - Fix race condition
#1743 - (this) Fix the live stream (initialize does not depend on duration)
#1829 - Example app refactor

@marianoarga
Copy link

I can confirm that 0.10.1 causes this issue
flutter/flutter#35402
Using the previous version (0.10.0+8) works as spected.

Thank you @ianko

@cyanglaz cyanglaz changed the title [video_player] Revert changes from 0.10.1 [video_player] Make initialize not depend on duration, fix the live stream Jul 18, 2019
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. I have left some comments. One of them is a suggestion to an alternative solution for the problem. See if you like it.

@@ -1,3 +1,7 @@
## 0.10.2

* iOS: Revert the changes made in version `0.10.1` that made live streams not able to initialize on the absence of `duration`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also add what is added in this patch as well.

for (NSValue* rangeValue in [_player currentItem].loadedTimeRanges) {
CMTimeRange range = [rangeValue CMTimeRangeValue];
int64_t start = FLTCMTimeToMillis(range.start);
if (start > maxBuffering) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we need this check? Can start somehow be negative? If the start is 0, do we not add the range.duration to maxBuffering?

}

- (int64_t)duration {
if (CMTIME_IS_INDEFINITE([[_player currentItem] duration])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is computing the length of loaded times in livestream. I personally would think the duration is the length of the whole video. Maybe create a different method for getting the "loadedTimes" for livestream videos?

}

/// The duration in the current video.
Future<Duration> get duration async {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would seem to fail if called on Android.

if (height == CGSizeZero.height && width == CGSizeZero.width) {
return;
}
// The player may be initialized but still needs to determine the duration.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the quicker fix can be something like

if ([self duration] == 0 && ![self isDurationIndefinate])

And create a method to check if the duration isDurationIndefinate as simple as

return CMTIME_IS_INDEFINITE([[_player currentItem] duration]);

This way we can avoid the breakage also we won't need to introduce the new api for duration anymore.

@cyanglaz cyanglaz self-assigned this Jul 18, 2019
@aletorrado
Copy link

Hi, could you please review the CLA task that is pending to move forward? This is pretty much needed. Thanks

@ianko
Copy link
Contributor Author

ianko commented Oct 15, 2019

Hi, could you please review the CLA task that is pending to move forward? This is pretty much needed. Thanks

I have signed already.

I believe that @bduyng has also signed.

@aletorrado
Copy link

Ok, I think a project admin is needed to change the cla:no tag to cla:yes.

@cyanglaz
Copy link
Contributor

cyanglaz commented Nov 7, 2019

@ianko Are you still planning to work on this? It seems that I left some review comments that haven't been addressed.

@ianko
Copy link
Contributor Author

ianko commented Nov 7, 2019

@ianko Are you still planning to work on this? It seems that I left some review comments that haven't been addressed.

@cyanglaz Unfortunately not in a short term.

@HenglyEver
Copy link

This bug seems to be very old and needed for everyone as I was reading through a lot of threads, so can you please fix it?

@VictorLekweuwa
Copy link

Please, is there a fix for this??

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.

9 participants