mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-09-12 21:01:50 +02:00
Configure time observer on the main queue
This commit is contained in:
@@ -137,7 +137,9 @@ class AudioPlayer: NSObject {
|
||||
}
|
||||
|
||||
private func setupTimeObserver() {
|
||||
removeTimeObserver()
|
||||
// Time observer should be configured on the main queue
|
||||
DispatchQueue.main.sync {
|
||||
self.removeTimeObserver()
|
||||
|
||||
let timeScale = CMTimeScale(NSEC_PER_SEC)
|
||||
// Rate will be different depending on playback speed, aim for 2 observations/sec
|
||||
@@ -155,6 +157,7 @@ class AudioPlayer: NSObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func removeTimeObserver() {
|
||||
if let timeObserverToken = timeObserverToken {
|
||||
|
||||
Reference in New Issue
Block a user