Application collectors
Bitmovin Media Player
Android Collector
The Bitmovin Media Player is a configuration option for the Android Collector by Datazoom when it is configured with the NaN to make the following additional data points automatically collectable in real time.
Data Points
Events
Discrete occurrences driven by user interactions or system actions
Metadata
Player
Video
User
Attributes
Fluxdata
Metrics measuring changing parameters over time
Adding dependencies to your project
(a) You can download the latest version of the library file from the below URL and add it into your project's libs directory android-bitmovin-collector else you can follow step (b)… (b) Add following maven repository URL in your project's build.gradle file Maven Add following dependency in your project's build.gradle file's dependencies block Maven Add following compile options if you don't have it already compileOptions Add retrofit library to your project retrofit Use the following code snippet to add the BitmovinPlayerCollector to your project. This part of code need to be called inside method onStop() to stop collector Datazoom allows customers to collect custom events and metadata that don't originate from a video player. a. Create a JSONArray with necessary metadata b. Add the metadata to DZEventCollector Example: a. Create an Event object b. Add the event to DZEventCollector. Example:maven {
// Snapshot Repository
maven {
url 'https://gitlab.com/api/v4/projects/18323233/packages/maven'
}
// Release Repository
maven {
url 'https://gitlab.com/api/v4/projects/10353305/packages/maven'
}
}
dependencies {
implementation 'com.datazoom.android:base-collector-gold:3.5.0'
implementation 'com.datazoom.android:android-bitmovin-collector:3.6.0'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies {
implementation 'com.bitmovin.player:player:3.35.0'
// Only needed if ads are used
implementation "com.google.ads.interactivemedia.v3:interactivemedia:3.29.0"
// Only needed if ads are used
implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"
}
Following code snippet illustrates the usage of the BitmovinPlayer collector. Open demo application's MainActivity.java to see a running example.String configId = <configuration id from Datazoom>;
String configUrl = <url given by Datazoom>;
BitmovinPlayerCollector bitmovinPlayerCollector = new BitmovinPlayerCollector();
bitmovinPlayerCollector.create(bitmovinPlayer, BitmovinActivity.this)
.setConfig(new DatazoomConfig(configId, configUrl))
.connect(new DZBeaconConnector.ConnectionListener() {
@Override
public void onSuccess(DZEventCollector dzEventCollector) {
sdkInitialized = true;
setupCustomMetadata();
setupCustomEvent(dzEventCollector);
}
@Override
public void onError(Throwable t) {
showAlert("Error", "Error while creating NativeAndroidConnector, error:" + t.getMessage());
}
});
@Override
protected void onStop() {
super.onStop();
bitmovinPlayerCollector.onStop();
}
Custom Events and Metadata
Custom Metadata
JSONArray metadata = new JSONArray( "[{\"customMetadata\": \"MetadataValue\"}]"); or HashMap<String, Object> metadata = new HashMap<String, Object>;
dzEventCollector.setDatazoomMetadata(metadata); or dzEventCollector.setCustomMetadata(HashMap<String, Object> metadata);
@Override
public void onSuccess(DZEventCollector dzEventCollector) {
try {
dzEventCollector.setDatazoomMetadata(new JSONArray("[{\"customPlayerName\": \"Exo Player\"}," + "{\"customDomain\": " + "\"platform.io\"}]")); } catch (JSONException e) {
e.printStackTrace();
}
}
Custom Events
Event event = new Event("Custom_Event_Name", new JSONArray()); or Event event = new Event(String type, HashMap<String, Object> metadata);
dzEventCollector.addCustomEvent(event);
@Override
public void onSuccess(DZEventCollector dzEventCollector) {
Event event = new Event("SDKLoaded", new JSONArray());
dzEventCollector.addCustomEvent(event);
btnPush.setOnClickListener(v -> {
try {
Event event1 = new Event("btnPush", new JSONArray("[{\"customPlay\": \"true\"}] "));
dzEventCollector.addCustomEvent(event1);
} catch (JSONException e) {
e.printStackTrace();
}
});
}