mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 07:07:22 +02:00
Guard against player actions before player is initialized
This commit is contained in:
@@ -167,6 +167,8 @@ class AudioPlayer: NSObject {
|
|||||||
|
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
public func play(allowSeekBack: Bool = false) {
|
public func play(allowSeekBack: Bool = false) {
|
||||||
|
guard self.isInitialized() else { return }
|
||||||
|
|
||||||
if allowSeekBack {
|
if allowSeekBack {
|
||||||
let diffrence = Date.timeIntervalSinceReferenceDate - lastPlayTime
|
let diffrence = Date.timeIntervalSinceReferenceDate - lastPlayTime
|
||||||
var time: Int?
|
var time: Int?
|
||||||
@@ -202,6 +204,8 @@ class AudioPlayer: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func pause() {
|
public func pause() {
|
||||||
|
guard self.isInitialized() else { return }
|
||||||
|
|
||||||
self.audioPlayer.pause()
|
self.audioPlayer.pause()
|
||||||
self.status = 0
|
self.status = 0
|
||||||
self.rate = 0.0
|
self.rate = 0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user