Enable ads in full-event replay

Full-event replay (FER) is a VOD asset that acts, in terms of ad insertion, as a live/DVR asset, so your application must take steps to ensure that ads are placed correctly.

For live content, the PSDK uses the metadata/cues presented in the manifest to determine where to place ads. However, sometimes live/linear content looks like VOD content, for example, when live content completes, an EXT-X-ENDLIST tag is appended to the live manifest. For HLS, the presence of the EXT-X-ENDLIST tag means that the stream is a VOD stream, and there is no way for the PSDK to automatically differentiate it from a normal VOD stream so that it can insert ads correctly.

Therefore, your application must notify the PSDK of this situation by specifying the AdSignalingMode.

For a FER stream, you do not want the Ad Decisioning server to provide the list of ad breaks that need to be inserted on the timeline prior to beginning playback, as would be usual for VOD. Instead, by specifying a different signaling mode, the PSDK reads all the cue points from the FER manifest and goes to the ad server for each cue point to request an ad break (similar to live/DVR).

Besides each request associated with a cue point, the PSDK makes an additional ad request for pre-roll ads.

  1. Obtain from an external source (vCMS, etc.) the signaling mode that should be used.
  2. Create advertising-related metadata as usual.
  3. Specify the PTAdSignalingMode using AdvertisingMetadata.setSignalingMode if the default behavior must be overridden.

    Valid values are PTAdSignalingModeDefault, PTAdSignalingModeManifestCues, PTAdSignalingModeServerMap.

    You must set the ad signaling mode before calling prepareToPlay. After the PSDK has started resolving and placing ads on the timeline, any change to the ad signaling mode is ignored. The recommended way is to set it when creating the advertising metadata for the resource (when creating the advertising metadata for the resource).

  4. Continue to playback as usual.
PTMetadata *metadata = [[[PTMetadata alloc] init] autorelease];
PTAuditudeMetadata *adMetadata = [[[PTAuditudeMetadata alloc] init] autorelease];
adMetadata.zoneId = your-auditude-zone-id;
adMetadata.domain = @"your-auditude-domain";
//adMetadata.enableDVRAds = YES; // FOR LIVE DVR case
//adMetadata.signalingMode = PTAdSignalingModeManifestCues; 
// FOR VOD FER case
NSMutableDictionary *targetingParameters = [[[NSMutableDictionary alloc] init] autorelease];
[targetingParameters setValue:@"ipad" forKey:@"device"];
[targetingParameters setValue:@"preroll" forKey:@"AD_OPPORTUNITY_ID"];
adMetadata.targetingParameters = targetingParameters;
NSMutableDictionary *customParameters = [[[NSMutableDictionary alloc] init] autorelease];
[customParameters setValue:@"your-media-id" forKey:@"NW_ID"];
[customParameters setValue:@"preroll" forKey:@"AD_OPPORTUNITY_ID"];
adMetadata.customParameters = customParameters;
[metadata setMetadata:adMetadata forKey:PTAdResolvingMetadataKey];