当我在externalMetadata
上设置AVPlayerItem
并将其加载到AVPlayerViewController
的播放器中时,它会在信息中加载我的元数据,但文字已淡化http://drop.lyokotech.com/image/0F0V2W1c431A/Screen%20Shot%202015-11-10%20at%2014.30.03.png
知道为什么会这样吗?这是我加载它的方式(从根视图控制器)
func getMetadata() -> [AVMetadataItem] {
var items = [AVMetadataItem]()
func createMetaDataItem(key: String, value: String) -> AVMetadataItem {
let data = AVMutableMetadataItem()
data.key = key
data.value = value
data.keySpace = AVMetadataKeySpaceCommon
data.locale = NSLocale.currentLocale()
return data
}
let title = createMetaDataItem(AVMetadataCommonKeyTitle, value: "SOME TITLE")
let description = createMetaDataItem(AVMetadataCommonKeyDescription, value: "SOME DESCRIPTION")
items.append(title)
items.append(description)
return items
}
let metadata = getMetadata()
if let path = NSBundle.mainBundle().pathForResource("IMG_0343", ofType: "MOV") {
let url = NSURL(fileURLWithPath: path)
let item = AVPlayerItem(URL: url)
item.externalMetadata = metadata
let player = AVPlayer(playerItem: item)
let av = AVPlayerViewController()
av.player = player
av.player?.play()
presentViewController(av, animated: true, completion: nil)
}
无论是使用本地文件还是流(HLS)
,都会发生这种情况答案 0 :(得分:0)
这是由于模拟器中的问题。它可以在真实设备上正常工作。