Skip to content

Commit 229cd8c

Browse files
committed
Fix buffering overlay showing when stopping the player
1 parent cf30ad8 commit 229cd8c

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

SwiftRadio/ViewControllers/NowPlayingViewController.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,13 @@ class NowPlayingViewController: UIViewController {
117117

118118
func playerStateDidChange(_ state: FRadioPlayer.State) {
119119
switch state {
120-
case .loading:
120+
case .loading where player.playbackState != .stopped:
121121
albumArtworkView.setBuffering(true)
122122
case .readyToPlay, .loadingFinished:
123123
albumArtworkView.setBuffering(false)
124124
playbackStateDidChange(player.playbackState)
125-
case .error:
126-
albumArtworkView.setBuffering(false)
127125
default:
128-
break
126+
albumArtworkView.setBuffering(false)
129127
}
130128
}
131129

SwiftRadio/ViewControllers/StationsViewController.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,10 @@ extension StationsViewController: FRadioPlayerObserver {
284284

285285
func radioPlayer(_ player: FRadioPlayer, playerStateDidChange state: FRadioPlayer.State) {
286286
switch state {
287-
case .loading:
287+
case .loading where player.playbackState != .stopped:
288288
isBuffering = true
289-
case .readyToPlay, .loadingFinished, .error:
290-
isBuffering = false
291289
default:
292-
break
290+
isBuffering = false
293291
}
294292
updateNowPlayingAnimation()
295293
updateVisibleCellsNowPlaying()

0 commit comments

Comments
 (0)