CarPlay: CPListItem isPlaying indicator not updating

I've created a CPListTemplate with dynamic list entries from an API. All entries are different music channels. In my ForEach for generating all list entries, I've set the .isPlaying property to true and also the playingIndicatorLocation to .trailing. If I play a channel, the isPlaying indicator is animated on every list entries. I've set different metadata in the MPNowPlayingInfoCenter and this is correct inside the CPNowPlayingTemplate. Do I need to set some identifier somewhere, so my list template knows which channel is currently playing? If so where can I set this?

Accepted Reply

Hello! You are correct that the system has no way to know which specific list item is playing.

Generally, the best practice is to set the .isPlaying property ONLY on the list item that represents the currently-playing item. You can see a similar behavior in other CarPlay apps, which tend to mark only one item as playing at a time.

As you noted, the bars will animate (and pause) automatically when your app starts (and stops) playing. Keeping the playing indicator only on the actively playing list item is the best way to indicate to the user which item is playing.

  • OK, thanks for this answer. I've already implemented this mechanism. The only problem is, if you click a list item the CPNowPlayingTemplate is pushed to the navigation stack and if I navigate back to the list, it is not updated (The icon is not there). Is there a way to force a refresh on the list? Because if I go back one step more and open again the list, the icon is there.

  • Assigning the isPlaying property to a list item should cause that row to reload in the table, showing or hiding the playing indicator as needed. If that isn't what you are seeing, please file a feedback report!

Add a Comment

Replies

Hello! You are correct that the system has no way to know which specific list item is playing.

Generally, the best practice is to set the .isPlaying property ONLY on the list item that represents the currently-playing item. You can see a similar behavior in other CarPlay apps, which tend to mark only one item as playing at a time.

As you noted, the bars will animate (and pause) automatically when your app starts (and stops) playing. Keeping the playing indicator only on the actively playing list item is the best way to indicate to the user which item is playing.

  • OK, thanks for this answer. I've already implemented this mechanism. The only problem is, if you click a list item the CPNowPlayingTemplate is pushed to the navigation stack and if I navigate back to the list, it is not updated (The icon is not there). Is there a way to force a refresh on the list? Because if I go back one step more and open again the list, the icon is there.

  • Assigning the isPlaying property to a list item should cause that row to reload in the table, showing or hiding the playing indicator as needed. If that isn't what you are seeing, please file a feedback report!

Add a Comment