Skip to content

Conversation

@abdelaziz-mahdy
Copy link
Contributor

@abdelaziz-mahdy abdelaziz-mahdy commented May 14, 2023

I am the maintainer of the package video_player_media_kit. While working with live streams, I encountered an issue where I needed to update the duration dynamically. However, I realized that there was no existing mechanism to update the duration.

This pull request aims to address this problem by introducing a new event called durationUpdate. This event allows the duration to be updated independently, providing greater flexibility when working with live streams. With this addition, developers will have the ability to send duration updates as needed.

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/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package 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.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@stuartmorgan-g
Copy link
Collaborator

Thanks for the contribution! This needs to follow the process described at https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins

@abdelaziz-mahdy abdelaziz-mahdy marked this pull request as draft May 26, 2023 18:37
@abdelaziz-mahdy abdelaziz-mahdy marked this pull request as ready for review May 26, 2023 18:47
@abdelaziz-mahdy
Copy link
Contributor Author

https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins following this i should get an approval on this first, then i should open a pr with the changes in the platform interface alone,

i did add the required tests in video_player, is there something else i should do, or only the approval remaining?

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

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

is this PR complete? I do not see relevant logic on native side that listens to duration change event.

## NEXT

* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.
* Adds listener to `VideoEventType.durationUpdated`.
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs a version bump so it can be released

@abdelaziz-mahdy
Copy link
Contributor Author

abdelaziz-mahdy commented Jun 1, 2023

is this PR complete? I do not see relevant logic on native side that listens to duration change event.

As explained in the description, I am a maintainer of a package that uses video_player package

So this change will help me greatly in my development of the package video_player_media_kit, since I do have duration updates there when playing live streams

I didn't implement the native side due to not having enough knowledge on how it should be handled correctly, I just implemented the platform interface enum, video_player listener and test

Which I need in my package, if other changes are required let me know

Also this change is a change of api right? So it should affect 0.x.0 the x version correct?

@hellohuanlin
Copy link
Contributor

can you provide more details on when the duration will change? is it specific to your package? or is it general behavior that this package may use in the future? is there other workarounds (such as using your own interface?)

@abdelaziz-mahdy
Copy link
Contributor Author

can you provide more details on when the duration will change? is it specific to your package? or is it general behavior that this package may use in the future? is there other workarounds (such as using your own interface?)

The duration changes when playing a live stream m3u8, while playing the duration will keep increasing

It's a specific behavior in media_kit which the layer I use to play videos on desktop

Does exo player or iOS native use it and it's ignored in this package, I don't know sadly

If I use my own interface I will have to use my own video_player and that will break the idea of me integrating easily with the video_player package and will have to handle updates whenever this package is updated keeping in mind it's all for a small change.

@stuartmorgan-g
Copy link
Collaborator

The duration changes when playing a live stream m3u8, while playing the duration will keep increasing

Please file an issue (you've checked the box, but didn't actually file an issue) with a reproducible test case, so that we can address this:

Does exo player or iOS native use it and it's ignored in this package, I don't know sadly

There's no inherent issue with us adding a new API that is only used by some implementations, but I'd like to understand if that's actually the case here, and if so why. In at least some cases, both AVPlayer and ExoPlayer will report an unknown time value for live streams, and we should determine:

  • If that's true for the cases you are trying to address in your implementation, or if they are also getting dynamic duration updates that we should be handling using this new API, and
  • If they aren't, why media_kit is doing something different, and if those differences are actually meaningful, or if they should be elided for consistency. (E.g., if it's just always saying the duration is the current playback point or something like that, then that's probably not valuable enough to create new API to preserve it.)

@abdelaziz-mahdy
Copy link
Contributor Author

The duration changes when playing a live stream m3u8, while playing the duration will keep increasing

Please file an issue (you've checked the box, but didn't actually file an issue) with a reproducible test case, so that we can address this:

Does exo player or iOS native use it and it's ignored in this package, I don't know sadly

There's no inherent issue with us adding a new API that is only used by some implementations, but I'd like to understand if that's actually the case here, and if so why. In at least some cases, both AVPlayer and ExoPlayer will report an unknown time value for live streams, and we should determine:

  • If that's true for the cases you are trying to address in your implementation, or if they are also getting dynamic duration updates that we should be handling using this new API, and
  • If they aren't, why media_kit is doing something different, and if those differences are actually meaningful, or if they should be elided for consistency. (E.g., if it's just always saying the duration is the current playback point or something like that, then that's probably not valuable enough to create new API to preserve it.)

The issue is related to my package should I file an issue when it's not a video_player issue?

Media_kit does the duration thing to allow people to seeking back when playing live videos

I may check exoplayer and avplayer if they allow this type of implemention and comment again for this details

@stuartmorgan-g
Copy link
Collaborator

The issue is related to my package should I file an issue when it's not a video_player issue?

You are trying to add functionality to video_player, by opening a PR against video_player; how is that not a video_player issue?

@abdelaziz-mahdy
Copy link
Contributor Author

abdelaziz-mahdy commented Jun 2, 2023

The issue is related to my package should I file an issue when it's not a video_player issue?

You are trying to add functionality to video_player, by opening a PR against video_player; how is that not a video_player issue?

I am adding a feature in video_player that will help me fix an issue in my platform interface

For video_player it's a feature

For me it's a fix for an issue

@stuartmorgan-g
Copy link
Collaborator

The Flutter issue tracker (like most issue trackers) tracks both bug reports and feature requests, so I'm not sure why you are concerned about the distinction.

@abdelaziz-mahdy
Copy link
Contributor Author

The Flutter issue tracker (like most issue trackers) tracks both bug reports and feature requests, so I'm not sure why you are concerned about the distinction.

In that case, I will open an issue explaining that playing live streams don't provide the duration updates, which is limiting the functionality of seeking back when playing

I guess that is a good general issue

@camsim99 camsim99 removed their request for review June 8, 2023 18:33
@stuartmorgan-g
Copy link
Collaborator

@zezo357 Are you still planning on opening an issue for this to continue discussion?

@abdelaziz-mahdy
Copy link
Contributor Author

abdelaziz-mahdy commented Jun 20, 2023

@zezo357 Are you still planning on opening an issue for this to continue discussion?

Yes I am just busy these days, I found out exo player has this behavior (https://exoplayer.dev/live-streaming.html)

Of increasing the duration for live streams,

But didn't check iOS,

anyway i will work on creating the issue and android implementation when i got time

@abdelaziz-mahdy
Copy link
Contributor Author

I created an issue

@camsim99
Copy link
Contributor

camsim99 commented Jul 6, 2023

Thank you for your contribution. It looks like the tests are failing. Before we review the PR, please see what you can do to resolve the test failures. If you are unsure how to proceed, please reach out for help on the #hackers-new channel.

@stuartmorgan-g
Copy link
Collaborator

I'm going to mark this as a draft for now while the question of what other platforms would do with this is resolved in the issue.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft July 27, 2023 18:56
@stuartmorgan-g
Copy link
Collaborator

Since this is marked as a draft and hasn't been updated in several months I'm going to close it to clean out our review queue. Please don't hesitate to submit a new PR if you decide to revisit this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants