cal
cal

Reputation: 470

tvOS video: Title metadata truncated, artwork size too small

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;

Upvotes: 5

Views: 365

Answers (1)

David Baez
David Baez

Reputation: 1238

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.

Upvotes: 3

Related Questions