mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-31 07:09:53 +02:00
Guard against seeking during initialization
This commit is contained in:
parent
586405f9de
commit
dc8852eb0d
1 changed files with 6 additions and 1 deletions
|
@ -104,6 +104,7 @@ class PlayerHandler {
|
||||||
|
|
||||||
public static func seekForward(amount: Double) {
|
public static func seekForward(amount: Double) {
|
||||||
guard let player = player else { return }
|
guard let player = player else { return }
|
||||||
|
guard player.isInitialized() else { return }
|
||||||
guard let currentTime = player.getCurrentTime() else { return }
|
guard let currentTime = player.getCurrentTime() else { return }
|
||||||
|
|
||||||
let destinationTime = currentTime + amount
|
let destinationTime = currentTime + amount
|
||||||
|
@ -112,6 +113,7 @@ class PlayerHandler {
|
||||||
|
|
||||||
public static func seekBackward(amount: Double) {
|
public static func seekBackward(amount: Double) {
|
||||||
guard let player = player else { return }
|
guard let player = player else { return }
|
||||||
|
guard player.isInitialized() else { return }
|
||||||
guard let currentTime = player.getCurrentTime() else { return }
|
guard let currentTime = player.getCurrentTime() else { return }
|
||||||
|
|
||||||
let destinationTime = currentTime - amount
|
let destinationTime = currentTime - amount
|
||||||
|
@ -119,7 +121,10 @@ class PlayerHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func seek(amount: Double) {
|
public static func seek(amount: Double) {
|
||||||
player?.seek(amount, from: "handler")
|
guard let player = player else { return }
|
||||||
|
guard player.isInitialized() else { return }
|
||||||
|
|
||||||
|
player.seek(amount, from: "handler")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func getMetdata() -> [String: Any]? {
|
public static func getMetdata() -> [String: Any]? {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue