Reputation: 269
I'm setting the title and description as metadata for an AVPlayer video in tvOS. How can set the player duration in metadata?
Upvotes: 0
Views: 356
Reputation: 1264
the info overlay should automatically display the correct duration. if not, you can try this:
let duration = player?.currentItem?.duration
let titleItem = AVMutableMetadataItem()
titleItem.key = AVMetadataCommonKeyTitle
titleItem.keySpace = AVMetadataKeySpaceCommon
titleItem.locale = NSLocale.currentLocale()
titleItem.value = "My Video"
titleItem.duration = duration
Upvotes: 0