chewie icon indicating copy to clipboard operation
chewie copied to clipboard

Fix the logic of the Center Play Button icon selection

Open EmreDET opened this issue 1 year ago • 1 comments

Hello, this is a small fix. We saw that the plugin has a logical error whenever we did not initialize the video, the icon for the play button would show the "reload"-icon. This happens because: _latestValue.position >= _latestValue.duration indicates, that if duration was 0, the initial position would also be 0, therefore the video player icon logic falsely assumed that the video needs to be "reloaded" from the beginning. With this simple fix && _latestValue.duration.inSeconds > 0 we ensure, that it should only be treated as "isFinished" if the duration is non-zero, therefore was initialized. If needed, we can even do && _latestValue.duration.inMilliseconds > 0 or _latestValue.duration.inMicroseconds > 0, for further precision. Please correct me if I have made a mistake.

Thank you for your time and efforts. Emre Y.

EmreDET avatar Apr 12 '24 11:04 EmreDET

v

Good!

MrJohnDev avatar May 17 '24 08:05 MrJohnDev

Will this be merged soon? :)

In the meantime for others, here is my fork: https://github.com/EmreDET/chewie

chewie:
    git:
      url: https://github.com/EmreDET/chewie.git
      ref: master

EmreDET avatar Aug 01 '24 09:08 EmreDET

@EmreDET Thank you for your contribution.

Please confirm that this issue also applies to Cupertino as well. If it does, then apply the same fix there as well.

The earliest I'll be able to deploy this will be on Monday.

diegotori avatar Aug 01 '24 11:08 diegotori

Hey @diegotori, thank you for your quick response. Indeed, the same behavior was falsely in CupertinoControls & MaterialDesktopControls, I fixed them as well. I also recreated the iOS example app, so it runs on new devices (iPhone 15 Pro, iOS 17.4). Lastly, I added a test for that exact behavior.

Please let me know if I did something wrong. Thank you. Emre Y.

EmreDET avatar Aug 01 '24 13:08 EmreDET

@EmreDET published in version 1.8.3.

diegotori avatar Aug 05 '24 14:08 diegotori