Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fileprivate func invalidatePlayback(shouldResetIndex resetIndex: Bool = true) {
- stopProgressTimer()
- radioPlayer?.pause()
- radioPlayer?.rate = 0.0
- state = .paused
- radioPlayer = nil
- if resetIndex {
- playIndex = 0
- }
- }
- fileprivate func startNewPlayer(forItem item : AVPlayerItem) {
- invalidatePlayback(shouldResetIndex: false)
- radioPlayer = AVPlayer(playerItem: item)
- radioPlayer?.allowsExternalPlayback = false
- radioPlayer?.rate = 1.0
- startProgressTimer()
- seek(toSecond: 0, shouldPlay: true)
- updateInfoCenter()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement