diff --git a/Source/Jukebox.swift b/Source/Jukebox.swift index b7d0200..4df8d1c 100644 --- a/Source/Jukebox.swift +++ b/Source/Jukebox.swift @@ -139,7 +139,11 @@ extension Jukebox { player.seek(to: CMTimeMake(Int64(second), 1)) item.update() if shouldPlay { - player.play() + if #available(iOS 10.0, *) { + player?.playImmediately(atRate: 1.0) + } else { + player?.play() + } if state != .playing { state = .playing } @@ -354,7 +358,11 @@ open class Jukebox: NSObject, JukeboxItemDelegate { if state != .playing { startProgressTimer() if let player = player { - player.play() + if #available(iOS 10.0, *) { + player?.playImmediately(atRate: 1.0) + } else { + player?.play() + } } else { currentItem!.refreshPlayerItem(withAsset: currentItem!.playerItem!.asset) startNewPlayer(forItem: currentItem!.playerItem!) @@ -473,7 +481,11 @@ open class Jukebox: NSObject, JukeboxItemDelegate { func handleStall() { player?.pause() - player?.play() + if #available(iOS 10.0, *) { + player?.playImmediately(atRate: 1.0) + } else { + player?.play() + } } func playerItemDidPlayToEnd(_ notification : Notification){