Skip to content

Commit d56f40f

Browse files
Gustl22spydon
andauthored
fix(web): reset position, when stop or playing ended (#1246)
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
1 parent 8108ff4 commit d56f40f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/audioplayers_web/lib/wrapped_player.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class WrappedPlayer {
6666
streamsInterface.emitPosition(playerId, toDuration(p.currentTime));
6767
});
6868
playerEndedSubscription = p.onEnded.listen((_) {
69+
pausedAt = 0;
70+
player?.currentTime = 0;
6971
streamsInterface.emitPlayerState(playerId, PlayerState.stopped);
7072
streamsInterface.emitComplete(playerId);
7173
});
@@ -112,8 +114,9 @@ class WrappedPlayer {
112114
}
113115

114116
void stop() {
115-
pausedAt = 0;
116117
_cancel();
118+
pausedAt = 0;
119+
player?.currentTime = 0;
117120
}
118121

119122
void seek(int position) {

0 commit comments

Comments
 (0)