Skip to content

Commit

Permalink
fix: Seek not applied in play method (#1695)
Browse files Browse the repository at this point in the history
# Description

This PR is fixing the bug in which in web while initialising the play
with duration specified, there was no seek happening, which means that
it starts from the beginning itself. setting the source before calling
seek in play() function, instead of setting it afterwards solves the
issue.

Closes #1597
  • Loading branch information
Dhanesh-Sawant committed Nov 7, 2023
1 parent 0119378 commit f6138fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/audioplayers/lib/src/audioplayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ class AudioPlayer {
if (ctx != null) {
await setAudioContext(ctx);
}

await setSource(source);
if (position != null) {
await seek(position);
}
await setSource(source);

await resume();
}

Expand Down

0 comments on commit f6138fe

Please sign in to comment.