From 9f69e5e54fa1d6ee9b2211943332a1d0d54fb024 Mon Sep 17 00:00:00 2001 From: daniel parra Date: Sun, 7 Oct 2018 15:55:24 -0400 Subject: [PATCH 1/2] minimize stalling, plays with minimum buffer --- .DS_Store | Bin 0 -> 6148 bytes .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Source/Jukebox.swift | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 .DS_Store create mode 100644 Jukebox.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..04cef258434a81003a6170452b80b03c3677d405 GIT binary patch literal 6148 zcmeHK!EVz)5S>j!*#sdXfl80Q^j4vSA}S6@RwxI0s$@hDfLgn;h((&UVp|46D*pxi z5ueac;5T@)yRC}SN}M1+a zD%(dwhCb0F=*d#FI98DXUc39WPZfQnl&-E{jkTP?TTo6h)-#=a7(^%LH22f^`RAGW z_-ZEaHCm?#{Z|+PJtuXMCliyv|0BsKSyA@;=c={VzO{Z^>#pwJ?Y@u3rjE+Etcqbg zd&^G;aXC)B{o0txr5z`4va~+xJ$PZJWt>gZnN7|{DMH>IX48?Who+j23foWQUTEFX zoul5yeExXn*>><`u^r5Jcl)q*o-P(0{cvmW{MGU4=P&cGi?eS$2kd%mdn@-mUcmPY zLr@qH284lCWWXO@`pznToP3ioAPoFd2Kamkpp2o%#-Tkr(AX;guno5r*!KSp7_b8v zdTboR15qv&=u(xxVknmmf8gUnkBvi@PRfpqe*DPF-%ykt9sa + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Source/Jukebox.swift b/Source/Jukebox.swift index b7d0200..8d38c70 100644 --- a/Source/Jukebox.swift +++ b/Source/Jukebox.swift @@ -377,6 +377,11 @@ open class Jukebox: NSObject, JukeboxItemDelegate { invalidatePlayback(shouldResetIndex: false) player = AVPlayer(playerItem: item) player?.allowsExternalPlayback = false + + if #available(iOS 10.0, *) { + player?.automaticallyWaitsToMinimizeStalling = false + } + startProgressTimer() seek(toSecond: 0, shouldPlay: true) updateInfoCenter() From 29eb481b65fcd07076c21a184029ecfb05b845f0 Mon Sep 17 00:00:00 2001 From: daniel parra Date: Sat, 12 Oct 2019 11:24:27 -0500 Subject: [PATCH 2/2] nil value fixed --- Source/Jukebox.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Jukebox.swift b/Source/Jukebox.swift index 8d38c70..cec4f0e 100644 --- a/Source/Jukebox.swift +++ b/Source/Jukebox.swift @@ -356,8 +356,9 @@ open class Jukebox: NSObject, JukeboxItemDelegate { if let player = player { player.play() } else { - currentItem!.refreshPlayerItem(withAsset: currentItem!.playerItem!.asset) - startNewPlayer(forItem: currentItem!.playerItem!) + guard let currentItem = currentItem else { return } + currentItem.refreshPlayerItem(withAsset: currentItem.playerItem!.asset) + startNewPlayer(forItem: currentItem.playerItem!) } state = .playing }