The following procedure describes the steps required to implement real-time video tracking in
your player using the video heartbeat library. For the Android implementation, the
lifecycle of the AppMeasurement library is not in the hands of the application
developer. The AppMeasurement library gets instantiated automatically at application
load time and is made available as a globally accessible singleton. The immediate
consequence of this approach is that the application developer is only concerned
with the instantiation of the video heartbeat library, which is capable of obtaining
a reference to the AppMeasurement instance behind the scenes. This is in contrast
with the Desktop (AS/JS) clients, where the application developer is required to
explicitly resolve the dependency chain between the video heartbeat and
AppMeasurement libraries.
-
Instantiate video heartbeat library. Instantiating the video heartbeat library is a
two-step process. In order to function properly, the video heartbeat instance
must aggregate an implementation of the IPlayerDelegate
interface. It is the responsibility of the video player developer to implement
and instantiate this interface.
import com.adobe.primetime.videoheartbeat.adb.VideoHeartbeat;
import com.adobe.primetime.videoheartbeat.IPlayerDelegate;
// The CustomPlayerDelegate class implements the IPlayerDelegate interface.
CustomPlayerDelegate playerDelegate = new CustomPlayerDelegate();
VideoHeartbeat videoHeartbeat = new VideoHeartbeat(playerDelegate);
-
Configure load time options in the ADBMobileConfig.json resource
file:
Most of the configuration options are captured inside a JSON-formatted configuration file.
(A limited number of options are available at run-time through API calls.)
The config file must be bundled with the application itself as a resource
file. This resource file is scanned only once at application load time. Once
these values are read from the configuration file, they remain constant
throughout the lifecycle of the whole application. Thus the configuration
steps are as follows:
- Fill in the JSON config file (
ADBMobileConfig.json) with the appropriate
values.
- Place this file into the assets folder. This folder
must be in the root of your application source tree.
- Compile and build the final application.
- Deploy and run the bundled application.
{
"version" : "1.1",
"analytics" : {
"rsids" : "adobedevelopment",
"server" : "10.131.129.149:3000",
"charset" : "UTF-8",
"ssl" : false,
"offlineEnabled" : false,
"lifecycleTimeout" : 5,
"batchLimit" : 50,
"privacyDefault" : "optedin",
"poi" : []
},
"target" : {
"clientCode" : "",
"timeout" : 5
},
"audienceManager" : {
"server" : ""
}
}
The AppMeasurement-specific configuration settings are outside the scope of this document.
For information on those settings, see Measuring Video in Adobe
Analytics.
-
Configure the video heartbeat module.
Sample video heartbeat configuration:
ConfigData config = new ConfigData(appContext,
"the name of your player app",
"some URL here",
"some JOB-ID here",
"some publisher here");
config.ovp = "example ovp";
config.sdk = "example sdk version";
// Set this to true to activate the debug tracing
config.debugLogging = true;
// Set this to true to log the URLs of the output HTTP calls.
config.debugTracking = true;
// Setting this to true activates the "quiet" mode.
config.trackLocal = false;
// Explicitly activate the video heartbeat functionality.
config.enableHeartbeat = true;
videoHeartbeat.config(config);
The video heartbeat configuration follows the builder pattern: a configuration object is
built (an instance of the ConfigData class). The
configuration object is passed as an input parameter to the
config() method exposed by the video heartbeat
instance.
There are two types of configuration parameters that can be set on the
configuration object:
- Mandatory configuration parameters. This set of parameters
are provided as input arguments to the constructor method of the
ConfigData class. Below is a description of these parameters in
order:
- Application context - A reference to the context
object associated with the Android application (i.e., an
instance of the Context class).
- Player app name - The name of your player
application. Any string can be provided here.
- URL of the tracking end-point - This is where all of
the video-heartbeat calls are sent. This value is provided
by Adobe in advance.
- jobId - This is the processing job identifier. It is
an indicator for the back-end end-point about what kind of
processing should be applied for the video-tracking calls.
This value is provided by Adobe in advance.
- publisher - This is the name of the content
publisher. This value is provided by Adobe in advance.
- Optional configuration parameters. These parameters are
provided as publicly accessible instance variables on the ConfigData
class. Below is a summary of the available properties:
- channel - This is the name of the distribution
channel. Any string can be provided here.
- ovp - This is the name if the Online Video Platform
through which the content gets distributed. (For example:
YouTube.) It can be any arbitrary string.
- sdk - This is the version string of the video-player
app. It can be any arbitrary string.
Important: Observe (in the code sample above) the explicit
activation of the heartbeat video tracking functionality (
[config.enableHeartbeat = true;];). The application
developer must set the enableHeartbeat flag to
true inside the configuration object. If this step is
omitted, no heartbeat calls will be sent over the network; instead, the
legacy "Milestone" tracking provided by the AppMeasurement library will be
used.
Note:
- Setting the debugLogging flag to
true activates extensive tracing messaging,
which may impact performance. While tracing is useful during
development and debugging efforts, the application developer must
set this to false for the production version of the player app. The
logging mechanism is disabled by default.
- Setting the trackLocal flag to
true activates "quiet" mode. In this mode, no
network calls are sent over the network at all. You can use this
mode in conjunction with setting debugTracking to
true. In this scenario, the developer gets to
see the HTTP calls in the trace console without actually sending
anything over the wire.
-
Tear down the video heartbeat instance.
The integration engineer is responsible for manually and explicitly managing the lifecycle
of the video heartbeat instance. As a result, the
IVideoHeartbeat interface also provides a destroy selector
that allows for the execution of various tear-down operations (including
de-allocating internal
resources):
videoHeartbeat.destroy()