The following procedure describes the steps required to implement real-time video tracking in
your player using the video heartbeat library. For the iOS implementation, the
lifecycle of the AppMeasurement library is not in the hands of the application
developer. The AppMeasurement library is instantiated automatically at application
load time, and is made available as a globally accessible singleton. So, the
application developer is only concerned with the instantiation of the video
heartbeat library, which obtains 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 the video heartbeat library.
Instantiating the video heartbeat library is a two-step process. The video heartbeat
instance must aggregate an implementation of the
ADBVideoHeartbeatPlayerDelegate protocol. It is the
responsibility of the video player developer to implement and instantiate this
protocol:
#import "ADBVideoHeartbeat.h"
// The CustomPlayerDelegate class implements the ADBVideoHeartbeatPlayerDelegate protocol.
CustomPlayerDelegate *playerDelegate = [[CustomPlayerDelegate alloc] init];
ADBVideoHeartbeat *videoHeartbeat = [[ADBVideoHeartbeat alloc] initWithPlayerDelegate:playerDelegate];
-
Set 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 AdobeMobile 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:
vhbConfig = [[ADB_VHB_ConfigData alloc]
initWithPlayerName:@"the name of your player app"
andTrackingServer:@"some URL here"
andJobId:@"some JOB-ID here"
andPublisher:@"some publisher here"];
[vhbConfig setChannel:@"example channel"];
[vhbConfig setOvp:@"example ovp];
[vhbConfig setSdk:@"example sdk version"];
// Set this to true to activate the debug tracing
[vhbConfig setDebugLogging:YES];
// Set this to true to log the URLs of the output HTTP calls.
[vhbConfig setDebugTracking:YES];
// Setting this to YES activates the "quiet" mode.
[vhbConfig setTrackLocal:NO];
// Explicitly activate the video heartbeat functionality.
[vhbConfig setEnableHeartbeat:YES];
[videoHeartbeat config:vhbConfig];
The video heartbeat configuration follows the builder pattern: a configuration object is
built (an instance of the ADB_VHB_ConfigData class). The
configuration object is passed as an input parameter to the config selector
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:
- 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 (
[vhbConfig setEnableHeartbeat:YES];). 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
ADB_VHB_VideoHeartbeatProtocol protocol also provides a
destroy selector that allows for the execution of various tear-down operations
(including de-allocating internal
resources):
[videoHeartbeat destroy];