Flutter-AssetsAudioPlayer icon indicating copy to clipboard operation
Flutter-AssetsAudioPlayer copied to clipboard

Song file does not start from seek or seek by value in iOS and Android both

Open anil03 opened this issue 4 years ago • 4 comments

Flutter Version 2.2.3

My version : 2.2.3

Lib Version 3.0.3+6

My version : 3.0.3+6

Platform (Android / iOS / web) + version

Platform : iOS and Android

Describe the bug

There is one audio file which 12 mins long, I am trying to divide it in 3 part logically by providing a start and end position.

First part is start from 0 to 240 secs and second part start from 240 to 480 seconds and remaining into third part.

When I start from Part 1 then it goes in sequence . But when I click directly start from part 2 that is 240 seconds. then again it start from beginning that is 0 seconds. It should logically Strat from 240 seconds since I have provided the seek value 240 seconds. This is same case for when I directly play part 3. it should start from 480 seconds to remaining seconds. But I can not achieve since player is behaving randomly. Any help much appreciated.

anil03 avatar Sep 22 '21 17:09 anil03

I have the same issue

yelkamel avatar Dec 21 '21 11:12 yelkamel

Same issue, everytime I use play() method, it's always start from Duration 0. Eventough I already set seek() value

HCfebrian avatar Jan 01 '22 09:01 HCfebrian

I've tracked down the issue to this line: https://github.com/florent37/Flutter-AssetsAudioPlayer/blob/4976d423c9fb3ec625ef0648d915b58ffb88a116/darwin/Classes/Music.swift#L885

Why does seek() need to be set again after setting loop mode? Either way, first it sets it to the right position, then it picks up the wrong currentPosMillis in that method and therefore resets it to the position 0.0 again.

From what I can tell, this works as expected on Android.

I could create a PR for this if I just would get a hint if this line could just be deleted of if that affects anything else.

mt633 avatar Jan 23 '23 15:01 mt633