jakky1 / video_player_win

Flutter video player for Windows, lightweight, using Windows built-in Media Foundation API. Windows implementation of the video_player plugin.
BSD 3-Clause "New" or "Revised" License
35 stars 11 forks source link

[Support request] Can I make position property updated more frequently? #14

Closed 6260coder closed 1 year ago

6260coder commented 1 year ago

I want my video player to be able to automatically pause at the end of a subtitle. So in my code I check the player's current position at regular intervals to see whether it has reached the point it should pause at.

But it seems that in video_player_win, VideoPlayerController's position property is only updated about once a second. This doesn't make the pause accurate enough.

What can I do to solve this problem? Is there something I can change to make position updated at a higher frequency? Or am I approaching this entirely the wrong way? I also tried addListener(), but the callback function seemed to be invoked every one second as well. Some help is much appreciated.

I tested the same code with video_player on Android. I was able to obtain about the right values of position at intervals of 100 milliseconds.

Thank you very much!

jakky1 commented 1 year ago

Hi, I try to fix the way to get player position, and pushed to github only currently.

Please try it :

dependencies:
  video_player: ^2.5.1
  video_player_win:
    git:
      url: https://github.com/jakky1/video_player_win.git
      ref: master

If it works, please let me know, and I will push to pub.dev

6260coder commented 1 year ago

Hi jakky1, I tried your fix just now. It seems to be working perfectly. It now acts consistenly with video_player as far as my code is concerned. Many thanks for your quick response and support! Cheers!