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.
Any idea what can be causing this issue?
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.
Code Block ... // 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?