playheadPosition
From Engineering Client Portal
For situations where CMS data is used in conjunction with Nielsen SDK the application needs to call the playheadPosition
in the SDK every one second until a pause / stop. The playhead position is the current location in seconds of the playhead from the beginning of the asset.
Syntax
– (void) playheadPosition: (long long) playheadPos
Sending playheadposition for content
AVPlayer *player;
CMTime curTime=[player currentTime];
int pos = CMTimeGetSeconds(curTime);
[nAppApiObject playheadPosition:pos];
Sending playheadposition for ad
CMTime curTime=[adplayer currentTime];
long pos=CMTimeGetSeconds(curTime);
[nAppApiObject playheadPosition:pos];
Note: In case the individual ad details are not available, send ad pod (presence) details through the loadMetadata & playhead position and through
playheadPosition
.
Input Parameters
Parameter | Description |
---|---|
playheadPos | An Integer value representing the time in content in seconds (VOD – Video On Demand) or the current Unix timestamp (seconds since Jan-1-1970 UTC) (live). |
Output Parameters
Output Parameters (Return value) | Description |
---|---|
Void |
Notes
The player application must send the value of the playhead to the SDK every one second. The player application can schedule a timer with a one-second-period in a timer event and send the playhead position.
Buffering state
- Do not supply playhead position while the content is being buffered.
- If the content is in buffering state continuously for more than 30 seconds, call stop API.
Live Content
long long pos = [[NSDate date] timeIntervalSince1970];
[nAppApiObject playheadPosition:pos];
On-demand Content
CMTime curTime=[player currentTime];
long pos=CMTimeGetSeconds(curTime);
[nAppApiObject playheadPosition:pos];
Ad Content
CMTime curTime=[adplayer currentTime];
long pos=CMTimeGetSeconds(curTime);
[nAppApiObject playheadPosition:pos];
Note: The playhead positions for ad and content should be maintained separately.
Note: If playhead is not available from audio / video measurement, allow the app to start a timer (1-5 seconds) and send playhead position to SDK based on the timer event. Once the actual playhead is available, let the app send the proper playhead position. This allows the SDK to calculate and provide a closer value for duration.