Skip to content

Commit

Permalink
fix: broken progress bar after repeat (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko authored Mar 25, 2024
1 parent 2424550 commit 03c988e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/SwiftAudioEx/QueuedAudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ public class QueuedAudioPlayer: AudioPlayer, QueueManagerDelegate {
override func AVWrapperItemDidPlayToEndTime() {
event.playbackEnd.emit(data: .playedUntilEnd)
if (repeatMode == .track) {
self.pause()

// quick workaround for race condition - schedule a call after 2 frames
DispatchQueue.main.asyncAfter(deadline: .now() + 0.016 * 2) { [weak self] in self?.replay() }
} else if (repeatMode == .queue) {
Expand Down

0 comments on commit 03c988e

Please sign in to comment.