I'm setting the metadata for an AVPlayer video in tvOS. The video title always gets truncated, and the artwork image is much smaller than it should be, my code is below, any ideas?
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;
Currently the best solution I've been able to find to expanding the size of the metadata view is by adding a couple of \n to the description metadata item. Once the size of the metadata view increases, the image displayed will be larger. This should also prevent your title from being cut.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With