我正在tvOS中设置AVPlayer视频的元数据。视频标题总是被截断,艺术作品的图像比它应该的要小得多,我的代码在下面,有什么想法吗?
AVMutableMetadataItem *titleMetadataItem = [[AVMutableMetadataItem alloc] init];
titleMetadataItem.locale = NSLocale.currentLocale;
titleMetadataItem.key = AVMetadataCommonKeyTitle;
titleMetadataItem.keySpace = AVMetadataKeySpaceCommon;
titleMetadataItem.identifier = AVMetadataCommonIdentifierTitle;
titleMetadataItem.value = @"A long title that gets truncated";
AVMutableMetadataItem *artwork1 = [[AVMutableMetadataItem alloc] init];
artwork1.key = AVMetadataCommonKeyArtwork;
artwork1.keySpace = AVMetadataKeySpaceCommon;
artwork1.dataType = (__bridge NSString * _Nullable)(kCMMetadataBaseDataType_JPEG);
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlImgThumbnail]]];
artwork1.value = UIImageJPEGRepresentation(image, .4);
artwork1.locale = [NSLocale currentLocale];
//
NSArray *externalMetadata = [[NSArray alloc] initWithObjects:titleMetadataItem, artwork1, nil];
player.currentItem.externalMetadata = externalMetadata;
目前,我能找到的扩展元数据视图大小的最佳解决方案是在描述元数据项中添加两个。一旦元数据视图的大小增加,则显示的图像将更大。这也应该防止你的头衔被削减。