jhomlala / betterplayer

Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Apache License 2.0
889 stars 929 forks source link

[BUG] IOS 17 - Duration of video stuck at 00 #1258

Closed awnigharbia closed 9 months ago

awnigharbia commented 9 months ago

After IOS 17 update. I started to notice some videos have stuck at zero duration of video and everytime you pause and start the video it reset the playback from beginning.

As you can see like this:

Screenshot 2023-09-22 at 2 01 50 AM

Any help would be appreciated.

n0m4dz commented 9 months ago

Same issues in ios17

awnigharbia commented 9 months ago

I found a paid solution dm me for info.

erindolson commented 8 months ago

What worked for me:

In BetterPlayer.m in (void)onReadyToPlay

---      if (_player.status != AVPlayerStatusReadyToPlay) {
+++      if (_player.currentItem.status != AVPlayerItemStatusReadyToPlay || _player.status != AVPlayerStatusReadyToPlay) {

Not sure if this is the best solution, but it's a solution. There's some race condition exposed in iOS17 with checking the duration of the AVPlayerItem before the AVPlayerItem is is ready to be played (stated here to not check duration before status ready).

The real problem might be more related to the fact that this if doesn't check if AVPlayerItem's status is ready.

else if (context == presentationSizeContext){
        [self onReadyToPlay];
    }

I don't know enough about the video player stuff to say for sure what the best solution is.

RonakPustack commented 7 months ago

Why was this issue closed? What is the permanent solution?