Post

Replies

Boosts

Views

Activity

How to show/hide Now Playing button on CPTabBarTemplate
I'm working on adding CarPlay support to an audio app and I'd like to mimic the behavior of the Apple Music app on launch. Forgive me, but I think using Gherkin syntax here will help to best describe the desired behavior: GIVEN the Apple Music app is in a cold state (not launched or in memory) AND another audio app is actively playing audio WHEN I launch the Apple Music app from CarPlay THEN the Now Playing template is shown via a push AND the appropriate Now Playing info is shown AND the Now Playing button is shown on the tab bar AND the actively playing audio from another audio app is NOT interrupted The current behavior I see in my own app is that I can push on the Now Playing template and fill out the MPNowPlayingInfoCenter's info dictionary, but it won't render the info or show the Now Playing button on the tab bar until I start playing audio. Also, is there a way to hide the Now Playing button after the queue of content has finished playing? I'm able to pop the Now Playing template, but the Now Playing button is still present and tapping it will navigate the user to the now blank Now Playing template.
1
0
324
Mar ’25
Audio session activation occasionally fails from CarPlay
I'm working on adding CarPlay support to an audio app and am running into an issue. Occasionally, when a user opens the app from CarPlay while the main app scene is either not connected or is currently in the background, I will receive an error when attempting to activate the audio session. The code below mimics my setup: do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio) try AVAudioSession.sharedInstance().setActive(true) } catch { print(error) // NSOSStatusErrorDomain - 560557684: Session activation failed } That error code maps to AVAudioSession.ErrorCode.cannotInterruptOthers. Once in this state, all subsequent attempts to play different pieces of content will fail. However, things will start working normally if the user opens the app on their phone and tries again from CarPlay (while the app is in the foreground on their phone). I'm not sure why it would behave this way and want to note that I do have the audio background mode capability enabled. Has anyone else encountered this? Are there any workarounds or changes I could make to prevent this from happening?
0
1
99
Apr ’25