Post

Replies

Boosts

Views

Activity

Loading Indicator using `CPListTemplate` (CarPlay Audio App)
Hello, I am using CPListTemplate to display a list of radio streams. To be able to get the Items to be displayed in the list, I have to first make a network request. I would like to show a loading spinner while the request is in progress. Hows does one display a loading indicator in CPListTemplate? I have watched the 2020 "Accelerate your app with CarPlay" session. Here it shows how to show a Loading spinner but only as a response on a tap on an item. So this doesn't work for me. I have also found this post: https://developer.apple.com/forums/thread/662539 but the answer there is incomplete and it seems that it might not apply to Audio apps (?) There's nothing on the documentation that might suggest how to accomplish this. Is it even possible? it seems like a pretty common use case.
1
0
1.6k
Nov ’22
Correct usage of `playbackControlsIncludeTransportBar`
I am using AVPlayerViewController on tvOS and wish to hide the transport bar to implement my own. The docs here list a property for that functionality playbackControlsIncludeTransportBar https://developer.apple.com/documentation/avkit/avplayerviewcontroller/2874218-playbackcontrolsincludetransport but the same doc also mentions: Changing the value of this property doesn’t immediately change the visibility of the transport bar. Without mentioned what DOES change the visibility. So far I am unable to get it to work. let avPlayerViewController = AVPlayerViewController() avPlayerViewController.playbackControlsIncludeTransportBar = false avPlayerViewController.showsPlaybackControls = true addChild(avPlayerViewController) avPlayerViewController.didMove(toParent: self) // adds subview view.addSubviewAndFillBounds(avPlayerViewController.view) Any clues or documentation on how to get this to work? Thanks
1
0
1.1k
Aug ’20
Lock Screen Artwork AVPlayerViewController flickers
I am using AVMetadataItem to show artwork on the lockscreen (.commonIdentifierArtwork) of an app playing video using AVPlayerViewController with some custom UI. When I switch to AirPlay everything works as expected, except that the artwork sometimes "flickers" when I play/pause the playback. It flickers back and forth for a split second showing the app's icon and the Artwork specified in AVMetadataItem. ... 				 // metadata.artwork is UIImage? if let artwork = metadata.artwork, let jpgData = artwork.jpegData(compressionQuality: 1.0) { 								let artWorkMetadataItem =	makeMetadataItem(.commonIdentifierArtwork, value: jpgData as NSData) 								metadataItems.append(artWorkMetadataItem) 						} ... avPlayer.currentItem?.externalMetadata = metadataItems ... private func makeMetadataItem(_ identifier: AVMetadataIdentifier, value: Any) -> AVMetadataItem { 						let item = AVMutableMetadataItem() 						item.identifier = identifier 						item.value = value as? NSCopying & NSObjectProtocol 						item.extendedLanguageTag = "und" 						return item.copy() as! AVMetadataItem 				} Any idea what can be causing this issue?
2
0
959
Aug ’20
oldValue, newValue in NSKeyValueObservation are nil for some properties and not others
We are noticing that when we perform KVO Observations on AVPlayer properties and we pass [.old, .new] some properties still cause NSKeyValueObservation result to have nil values for oldValue, newValue. Example: (note that according to https://developer.apple.com/documentation/avfoundation/avplayeritem/1389493-status "You can observe this change using key-value observing.") playerItemStatusObservation = item.observe(\AVPlayerItem.status, options: [.old, .new]) {[weak self] item, change in 						// using `[.old, .new]` as options doesn't actually returns non-nil values in the `change` parameter! 				} Oddly observing isPlaybackLikelyToKeepUp does provide non-nil oldValue, newValue playerItemLikelyToKeepUpObservation = item.observe(\AVPlayerItem.isPlaybackLikelyToKeepUp, options: [.old, .new]) {[weak self] item, change in 						// using `[.old, .new]` as options actually returns non-nil values in `change` 				} Does anyone know the reason for this? Thank you
1
0
1.1k
Jul ’20