setPlayheadPosition(): Difference between revisions
From Engineering Client Portal
(Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Android SDK API Reference}} {{CurrentBreadcrumb}} Category:Digital Category:Android SDK API Reference For situation...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
*Not receive playhead updates when the content playback is paused or stopped. | *Not receive playhead updates when the content playback is paused or stopped. | ||
'''When streaming VOD (Video On Demand)''', the playhead position is the current location of the player from the beginning of the asset in seconds; | '''When streaming VOD (Video On Demand)''', the playhead position is the current location of the player from the beginning of the asset in seconds; | ||
'''When streaming live content''', the playhead position passed to the <code>AppSdk</code> is the current | '''When streaming live content''', the playhead position passed to the <code>AppSdk</code> is the current Unix timestamp (seconds since Jan-1-1970 UTC). | ||
== Syntax == | == Syntax == | ||
Line 19: | Line 18: | ||
! Parameter !! Description | ! Parameter !! Description | ||
|- | |- | ||
| playhead position || An Integer value representing the time in content in seconds (VOD – Video On Demand) or the current UTC | | playhead position || 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). | ||
|} | |} | ||
Latest revision as of 23:51, 29 May 2019
For situations where CMS data is used in conjunction with Nielsen’s SDK, the application needs to call the setPlayheadPosition
in the SDK every one second. For proper reporting, the SDK should
- Receive a playhead position update every one second on the playback of content.
- Not receive playhead updates when the content playback is paused or stopped.
When streaming VOD (Video On Demand), the playhead position is the current location of the player from the beginning of the asset in seconds;
When streaming live content, the playhead position passed to the AppSdk
is the current Unix timestamp (seconds since Jan-1-1970 UTC).
Syntax
public void setPlayheadPosition(long position)
Input Parameters
Parameter | Description |
---|---|
playhead position | 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. The client app can schedule a one-second-period timer to send the playhead position in the following manner:
Scheduling a one-second-period timer
//The client app can schedule a one-second-period timer to send the playhead position in the following manner.
class PlayerPositionTracker extends Thread implements Runnable
{
public static final int POSITON_INTERVAL = 1000;
@Override
public void run()
{
while (true)
{
long t = 0;
if (isPlaying)
{
if (isLive) // Live – dependent on media player
{
t = (c.getTimeInMillis()/ 1000;
if (mAppSdk != null)
mAppSdk.setPlayheadPosition(t);
}
else // VOD
{
t = mMediaPlayer.getCurrentPosition() / 1000;
if (mAppSdk != null)
mAppSdk.setPlayheadPosition(t);
}
}
Thread.sleep(POSITON_INTERVAL);
}
}
}