Get Computations From the Video Player

Video players must provide computational data that the video heartbeat library cannot determine itself.

The video heartbeat library is not capable of computing all of the information it requires to perform real-time video tracking. For example, video playhead data is owned and maintained by the player itself, so the player developer needs to provide:
  1. The current playhead value inside the main video content
  2. The current playhead value inside the ad content (if an ad is currently in progress)
To get this information from the player to the real-time video tracking code, the application developer must implement the IVideoHeartbeatPlayerDelegate interface.
The IVideoHeartbeatPlayerDelegate interface declares two methods that compute the two playhead values:
  • getMainAssetPlayhead() - Computes the current playhead value (in seconds) inside the main video content (excluding ad content).

    This method should return -1 when the main video has not yet started (in pre-roll scenarios), and when the main video playback has completed (in post roll scenarios).

  • getCurrentAdPlayhead() - Computes the current playhead value (in seconds) inside the currently active ad content.

    This method should return -1 when no ad is currently active.

Important: When the video heartbeat code invokes the getCurrentAdPlayhead() method, what needs to be returned is the playhead value relative to the beginning of the currently active ad. It there is no currently playing ad content, the value of -1 should be returned instead. When the video heartbeat code invokes the getMainAssetPlayhead() method, what needs to be returned is the playhead value relative to the beginning of the main asset excluding the ad content.

Implement the IVideoHeartbeatPlayerDelegate interface described above.

The application developer must implement this interface based on the specific APIs exposed by their video player. The instance created by the application developer is then passed on to the Video Analytics real-time tracking package via the constructor method exposed by the ADBVideoHeartbeat class.