Your application is responsible for using the appropriate PTTimedMetadata objects at the appropriate times.
During content parsing, which happens prior to playback, the PSDK identifies subscribed tags and notifies your application about them. Therefore, the time associated with each PTTimedMetadata is the absolute time on the playback timeline.
NOTE: The code below assumes that there is only a single PTTimedMetadata instance at a given time. If there are multiple instances, the application must save them appropriately into a dictionary (one method is to create an array at a given time and store all instances in that array).
Your application must:NSMutableDictionary *timedMetadataCollection;
- (void)onMediaPlayerSubscribedTagIdentified:(NSNotification *)notification
{
if (!timedMetadataCollection)
{
timedMetadataCollection = [[NSMutableDictionary alloc] init];
}
NSDictionary *userInfo = [notification userInfo];
PTTimedMetadata *timedMetadata = [(PTTimedMetadata *)[userInfo objectForKey:PTTimedMetadataKey] retain];
if ([timedMetadata.name isEqualToString: @"#EXT-OATCLS-SCTE35"])
{
NSLog(@"Adding timedMetadata %@ to timedMetadataCollection with time
%f",timedMetadata.name,CMTimeGetSeconds(timedMetadata.time));
NSNumber *timedMetadataStartTime = [NSNumber numberWithInt:(int)CMTimeGetSeconds(timedMetadata.time)];
[timedMetadataCollection setObject:timedMetadata forKey:timedMetadataStartTime];
}
[timedMetadata release];
}