-
Notifications
You must be signed in to change notification settings - Fork 172
Improve playback error handling and retry logic #4053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
40684b7
d824b3e
48e4e25
a6817a9
feeebee
1ceeca7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ extension NowPlayingPlayerItemViewController { | |||||||||||||||||||||||||||||||||||||
| addCustomObserver(Constants.Notifications.podcastChapterChanged, selector: #selector(updateChapterInfo)) | ||||||||||||||||||||||||||||||||||||||
| addCustomObserver(Constants.Notifications.episodeDownloaded, selector: #selector(update)) | ||||||||||||||||||||||||||||||||||||||
| addCustomObserver(UIApplication.willEnterForegroundNotification, selector: #selector(update)) | ||||||||||||||||||||||||||||||||||||||
| addCustomObserver(Constants.Notifications.playbackFailed, selector: #selector(update)) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| addCustomObserver(Constants.Notifications.sleepTimerChanged, selector: #selector(sleepTimerUpdated)) | ||||||||||||||||||||||||||||||||||||||
| addCustomObserver(Constants.Notifications.playerActionsUpdated, selector: #selector(reloadShelfActions)) | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -63,6 +64,7 @@ extension NowPlayingPlayerItemViewController { | |||||||||||||||||||||||||||||||||||||
| updateChapterInfo() | ||||||||||||||||||||||||||||||||||||||
| updateChapterProgress() | ||||||||||||||||||||||||||||||||||||||
| updateColors() | ||||||||||||||||||||||||||||||||||||||
| updateError() | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if !showingCustomImage { | ||||||||||||||||||||||||||||||||||||||
| ImageManager.sharedManager.loadImage(episode: playingEpisode, imageView: episodeImage, size: .page) | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -170,6 +172,21 @@ extension NowPlayingPlayerItemViewController { | |||||||||||||||||||||||||||||||||||||
| timeSlider.indeterminant = PlaybackManager.shared.buffering() && PlaybackManager.shared.playing() | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| func updateError() { | ||||||||||||||||||||||||||||||||||||||
| guard let playingEpisode = PlaybackManager.shared.currentEpisode() else { return } | ||||||||||||||||||||||||||||||||||||||
| var errorMessage = "" | ||||||||||||||||||||||||||||||||||||||
| if let playbackError = playingEpisode.playbackErrorDetails { | ||||||||||||||||||||||||||||||||||||||
| errorMessage = playbackError | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| if !errorMessage.isEmpty { | ||||||||||||||||||||||||||||||||||||||
| print("Error: \(errorMessage)") | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if let downloadError = playingEpisode.downloadErrorDetails { | ||||||||||||||||||||||||||||||||||||||
| print("Error: \(downloadError)") | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+177
to
+186
|
||||||||||||||||||||||||||||||||||||||
| var errorMessage = "" | |
| if let playbackError = playingEpisode.playbackErrorDetails { | |
| errorMessage = playbackError | |
| } | |
| if !errorMessage.isEmpty { | |
| print("Error: \(errorMessage)") | |
| } | |
| if let downloadError = playingEpisode.downloadErrorDetails { | |
| print("Error: \(downloadError)") | |
| let episodeTitle = playingEpisode.displayableTitle() | |
| if let playbackError = playingEpisode.playbackErrorDetails, !playbackError.isEmpty { | |
| FileLog.shared.addMessage("Playback error for episode '\(episodeTitle)': \(playbackError)") | |
| } | |
| if let downloadError = playingEpisode.downloadErrorDetails, !downloadError.isEmpty { | |
| FileLog.shared.addMessage("Download error for episode '\(episodeTitle)': \(downloadError)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants.Notifications.playbackFailedis wired toupdate(), andupdate()now callsupdateError(). This can cause the same error details to be logged repeatedly on unrelated update triggers (play/pause, chapter updates, foreground, etc.) and does a full UI refresh on playback-failed events. Consider observingplaybackFailedwith a dedicated handler that only invokesupdateError()(and/or removeupdateError()from the generalupdate()path).