tvOS 视频:标题元数据被截断,插图尺寸太小
tvOS video: Title metadata truncated, artwork size too small
我正在为 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;
目前我能找到的扩展元数据视图大小的最佳解决方案是向描述元数据项添加几个 \n。一旦元数据视图的大小增加,显示的图像就会变大。这也应该可以防止您的标题被删除。
我正在为 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;
目前我能找到的扩展元数据视图大小的最佳解决方案是向描述元数据项添加几个 \n。一旦元数据视图的大小增加,显示的图像就会变大。这也应该可以防止您的标题被删除。