I want to have audio integration to a carplay application. I have created a CPListTemplate with CPListItems and on tap of it, i am pushing a Now playing template. The audio does not seem to play and i cannot interact with the now playing screen.
Question:
- How do i pass the Audio URl to the now playing template so it can at-least play the sound?
- How do i interact with the player and display album artwork and text on the screen ?
Note: I am testing this on simulator and i have the Audio URL's in mp3 format.
var listItems: [CPListItem] = []
for playListItem in PlayListItems {
let item = CPListItem(text: playListItem.title, detailText: "")
item.handler = {listItem, completion in
let nowPlayingTemplate = CPNowPlayingTemplate.shared
nowPlayingTemplate.add(self)
nowPlayingTemplate.isAlbumArtistButtonEnabled = true
self.interfaceController?.pushTemplate(nowPlayingTemplate, animated: true)
}
listItems.append(item)
}
let sectionPlayList = CPListSection(items: listItems)
self.interfaceController?.pushTemplate(CPListTemplate(title: “Tab 1”, sections: [sectionPlayList]), animated: true)