Return Control Center to the system when not needed anymore #1156
+36
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR improves Control Center integration by returning Control Center to the system once Pillarbox does not need it anymore. This allows any other app previously integrated with it to automatically claim ownership again.
Previously Control Center integration was preserved during item transitions. This ensured that Control Center was never returned to another app when in use, especially when navigating between playlist items from the Control Center itself. This approach was too greedy, though, and we never really properly relinquished ownership once the underlying queue player has consumed all its items.
cc_before.mp4
cc_after.mp4
Changes made
AVPlayerItem
this means playback is not currently active and Control Center must be returned to the system.NowPlaying
struct with an enum (so that the totally empty state is now clearly identified).MPNowPlayingInfoPropertyIsLiveStream
in user info. This trick was used to preserve Control Center integration (which requires a non-empty dictionary). Instead, we now either use a totally empty dictionary (playback end) or a dictionary with at least an emptyMPMediaItemPropertyTitle
(when content is loaded in between items).Checklist