2

I'm developing a video app, using video_player package. I want to repeat the videos n times. I'm doing this by adding listener and when video reaches the end, if the current repetition is not equal to the N, I simply call the _videoPlayerController.seekTo(Duration.zero), it works as expected in iOS, but in Android it takes some time to play it again, because of the buffer I guess. I have some logs. When I call the seekTo, first log is:

D/AudioTrack(26148): stop(59): called with 194560 frames delivered

After some time(3-4 seconds) the other logs come and video plays after these logs:

D/AudioTrack(26148): getTimestamp_l(60): device stall time corrected using current time 21442303047753 D/AudioTrack(26148): getTimestamp_l(60): stale timestamp time corrected, currentTimeNanos: 21440694441753 < limitNs: 21442169902753 < mStartNs: 21442230902753 W/AudioTrack(26148): getTimestamp_l(60): retrograde timestamp time corrected, 21442169902753 < 21442303047753

I'm not sure the problem in here is the buffering but if so, is there anyway to prevent buffering while using seekTo in android or is there any other way to achieve this functionality?

drose1db
  • 21
  • 3

1 Answers1

0

I'm thinking this problem come from the initial thread so if you call your first seek initial code in did dependencies method or you can try to wrap initial code to addpostframe call back with binding.

 WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
    _playController(index: 0, durationInSeconds: 5);
  });

or try to call didChangeDepencies after the initState initialize.

  @override
  void didChangeDependencies() {
  super.didChangeDependencies();
  }
vb10
  • 641
  • 5
  • 14