mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Guard against player actions before player is initialized
This commit is contained in:
parent
f335d8735f
commit
872931f507
1 changed files with 4 additions and 0 deletions
|
@ -167,6 +167,8 @@ class AudioPlayer: NSObject {
|
|||
|
||||
// MARK: - Methods
|
||||
public func play(allowSeekBack: Bool = false) {
|
||||
guard self.isInitialized() else { return }
|
||||
|
||||
if allowSeekBack {
|
||||
let diffrence = Date.timeIntervalSinceReferenceDate - lastPlayTime
|
||||
var time: Int?
|
||||
|
@ -202,6 +204,8 @@ class AudioPlayer: NSObject {
|
|||
}
|
||||
|
||||
public func pause() {
|
||||
guard self.isInitialized() else { return }
|
||||
|
||||
self.audioPlayer.pause()
|
||||
self.status = 0
|
||||
self.rate = 0.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue