I have my CarPlay app working rather well. The content items appear; when the user taps an item, it plays; and the Now Playing screen shows the item being played.
BUT – the first time this is done after connecting to CarPlay, the Now Playing screen thinks that playback is paused. The big button in the middle is adrawn as a Play button, and although the duration of the item is shown, its position remains at zero. Meanwhile the sound is playing perfectly.
If I then tap on the Play button, a Play MPRemoteCommand is sent to the app, which ignores it (because already playing), so the sound continues. But the Play button in the Now Playing screen now turns into a Pause button, and the progress bar now starts to move forward, one second per second, from the correct position (that is, if I wait 10 seconds before tapping Play, the bar will start at 10 seconds not at 0).
From now on, everything is in step. Pausing and playing work as expected, both in function and in their effect on the Now Playing screen.
Here is the complete Now Playing info which is set when playback begins [logged directly by
NSLog]. It is set immediately after playback has begun.
MPNowPlayingInfoPropertyElapsedPlaybackTime = 0; MPNowPlayingInfoPropertyPlaybackRate = 1; albumTitle = Instructions; albumTrackCount = 1; albumTrackNumber = 1; artwork = "<UnivAlbumArtwork: 0x600003856de0>"; playbackDuration = "44.93757936507937"; title = "Download Instructions";
I am hoping that someone else has come across this and can tell me what I should be doing that I'm not! All this is being tested in the simulators on both Xcode 9 and Xcode 10, and this is the only anomaly.