AudioPlayer "status" unreliable at times
Xcoder89 opened this issue · comments
macOS Version(s) Used to Build
macOS 13 Ventura
Xcode Version(s)
Xcode 14
Description
Noticed during some instances (e.g. when replacing the playback file and followed by play), the Audioplayer's
status
is wrong (i.e isPlaying != playerNode.isPlaying
)
Possibly because of it's setting inside the internalCompletionHandler
.
Crash Logs, Screenshots or Other Attachments (if applicable)
No response
I was able to recreate this behavior and I think you are right that it is internalCompletionHandler
. That method is called
DispatchQueue.main.async {
self.internalCompletionHandler()
}
This leads to a race condition since .playing
is being set before the callback fires setting it to .stopped
. Removing the async wrapper fixes the issue, but I'm not sure if that changes something else.
This should now be fixed in the latest AudioKit build on the main branch. The async call was the culprit for the race condition. Feel free to reopen this if it is still giving you issues.