Logo

Application collectors

Bitmovin Media Player

Roku Collector

The Bitmovin Media Player is a configuration option for the Roku Collector by Datazoom that makes the following additional data points automatically collectable in real time.

Integration instructions

Adding dependencies to your project

Roku Plugin for Eclipse IDE
For Roku plugin installation and usage in Eclipse IDE
https://sdkdocs.roku.com/display/sdkdoc/Roku+Plugin+for+Eclipse+IDE

Installation Instructions

Clone the latest version of the repository:

git clone https://gitlab.com/datazoom/roku/dz_collector_roku_bitmovin_release.git

Extract the components folder from latest version of the cloned repository

Copy the components folder in your channel project.

We assume that:

  1. The developer had already created a Roku project (in Eclipse IDE).

  2. Roku project has Roku Bitmovin Player implemented following instructions from Bitmovin: https://bitmovin.com/docs/player/api-reference/roku/roku-sdk-api-reference-v1#/player/roku/1/docs/index.html#seeked_property

  3. The project does not have a components folder. If there is already a components folder, then copy the content of the components directory(DzLib folder) into your project's components directory.
    eg: /<your project>/components/DzLib

  4. This project contains the base and bitmovin-collector library (inside DzLib folder).

Configuring collector library in channel

Copy the following in MainScene.brs (in components folder) or in the brs file you intend to configure the collector library.
In Sub/function init(), add the following

m.player = m.top.findNode("<Player ID>")
m.DzLib = m.top.findNode("DzLib")
DzCollector()

Once the collector is successfully instantiated we can set desired console log level for the collector instance:

m.DzLib.callFunc("setLogLevel","info")

Valid log levels are: "off", "error", "warning", "info", "debug", or "verbose"

Default log level is set to “warning”

Also add the following function for initializing SDK

Sub DzCollector()
m.DzLib.libConfiguration = {
configURL : "<url given by Datazoom>",
configId: "<configuration id from Datazoom>"
}
m.DzLib.initiateCollector = true
End Sub

DzCollector() will call the above function when initialized.

Change the configURL, configId, and <Player ID> as per the requirement.

Copy the following inside <children> in MainScene.xml or in the xml file you intend to configure the collector library.

<DzLib id="DzLib" />

At this point the Datazoom SDK is initialized. We can send Custom Events, Custom Metadata, user data, device data and geo location data.

We can set Custom Metadata for the Datazoom SDK independently for the app session and/or for player. Custom Metadata that is set for app session will be available during entire app session if not changed or removed. Custom Metadata that is set for player will be reset with each new player session.

To set Custom Metadata for app session we use following method:

 m.DzLib.callFunc("setDZSessionMeta","DataZoom SESSION Metadata Key", "DataZoom SESSION Metadata Value")
 or
 m.DzLib.callFunc("setDZSessionMeta","AnotherCustomSESSIONMetaKey","AnotherCustomSESSIONMetaValue")
 or
 m.DzLib.callFunc("setDZSessionMeta",{customMetaKeyDict1 : "CustomSESSIONMetaValueDict1", customMetaKeyDict2 : "CustomSESSIONMetaValueDict2", customMetaKeyDictNth : "CustomSESSIONMetaValueDictNth" })

To set Custom Metadata for player session we use following method:

m.DzLib.callFunc("setDZPlayerMeta","DataZoom PLAYER Metadata Key", "DataZoom PLAYER Metadata Value")
or
m.DzLib.callFunc("setDZPlayerMeta","AnotherPLAYERCustomMetaKey","AnotherPLAYERCustomMetaValue")
or
m.DzLib.callFunc("setDZplayerMeta",{customMetaKeyDict1 : "CustomPLAYERMetaValueDict1", customMetaKeyDict2 : "CustomPLAYERMetaValueDict2", customMetaKeyDictNth : "CustomPLAYERMetaValueDictNth" })

Change "CustomMetaKey" and "CustomMetaValue" to any text or variable you want to send to collector service

To read Custom Metadata that are set using previous methods we use following methods:

For session Custom Metadata:

 customSessionMeta = m.DzLib.callFunc("getDZSessionMeta")

For player Custom Metadata:

 customSessionMeta = m.DzLib.callFunc("getDZPlayerMeta")

We delete Custom Metadata that are set for session and player by using this methods:

For session Custom Metadata:

m.DzLib.callFunc("rmDZSessionMeta")

For player Custom Metadata:

m.DzLib.callFunc("rmDZPlayerMeta")

Also, we can send Custom Events to the Datazoom SDK using following methods:

  m.DzLib.callFunc("generateDatazoomEvent","SOME CUSTOM EVENT")

We can also add Custom Metadata to generated Custom Event. Metadata sent using this method will be sent with the custom event only.

m.DzLib.callFunc("generateDatazoomEvent", "SOME CUSTOM EVENT", {customEventMetaKeyDict1 : "CustomEventMetaValueDict1", customEvemtMetaKeyDict2 : "CustomEventMetaValueDict2", customEventMetaKeyDictNth : "CustomEventMetaValueDictNth"})

Now, after we create player instance we can add player to Datazoom SDK
Add the following inside <children> in MainScene.xml or in the xml file you intend to configure the collector library.

<Video id="<Player ID>" />

and your xml file should look like this:

<children>
<DzLib id="DzLib" />
<Video id="<Player ID>" />
</children>

Change <Player ID> as per the requirement.

Now add the following function for initializing player to Datazoom SDK:

Sub DzPlayer()
        m.DzLib.playerInit = {
        player: m.video
        }
        m.DzLib.initiatePlayer = true 
'       m.DzLib.initiateCollector = true
End Sub

DzPlayer() will call the above function when initialized.

At this point Datazoom SDK is fully initialized with player. Selected data points will be collected from player and sent to collector service.

You can download Datazoom Roku DEMO app which demonstrates above methods from here :

git clone https://gitlab.com/datazoom/roku/roku-native-demo.git

Follow instructions in provided Readme.md file for importing demo project to Eclipse.

Instructions to create a compiled zip file

  1. Your-Project(Right click) > Export > BrightScript > BrightScript Deployment >[Change File name/path, if needed (.zip)] > Finish

  2. Open browser and go to Roku's local network IP address.(eg: 192.168.0.9). Provide username and password of developer mode.

  3. Click upload and select the newly created zip file. Click install.

  4. The channel will automatically start playing. This channel can also be played by-> go to Roku menu, select the Roku developer channel and play.

  5. To view the data points generated by Roku, go to Linux terminal and type

           telnet <Roku's Local IP> 8085
           eg: - telnet 192.168.0.9 8085