I have a web link to a video, in iOS I can open it with AVFoundation/AVKit frameworks inside AVPlayerViewController/AVPlayer.
But how can I open it in CarPlay?
Text from CarPlay documentation:
You cannot play video media items directly using the Media Player framework. To play back videos containing MPMediaItem objects, use an AVPlayer object from AVFoundation. The system player also provides a way to play video items using the system apps.
extension AppDelegate: CPListTemplateDelegate {
func listTemplate(_ listTemplate: CPListTemplate, didSelect item: CPListItem, completionHandler: @escaping () -> Void) {
if let url = item.userInfo as? String {
self.playVideo(url)
}
}
}