bug(android): update buffering metadata when any event emitted #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the video is paused, 'onPlaybackStateChanged' callback is never called more than once, this happens because the state is not different from the previous. The problem occours because the current implementation just send bufferingUpdates when the state change from BUFFERING to READY for example, but based on the settings of the LoadControl that is responsible for downloading the video frames, it downloads until 50seconds of video, and the state could be ready but the segments under the hood is being cached in memory.
Based on the screenshot below, you could see that the state could be ready because is necessary at least 2.5 seconds to play a video, and this is enough to the state be ready to play and not buffering.
What I did is on any event emitted, We will update the metadata of buffering stored in the Dart layer that is the responsible for the bug mentioned in the card.
The OnEvents was suggested by the docs of Android https://developer.android.com/media/media3/exoplayer/listening-to-player-events#individual-callbacks
Solves the problem in the card: https://www.notion.so/indaband/Track-is-never-selected-when-there-are-some-tracks-selected-previously-352a9b946ef845989aab0c08be448291?pvs=4