Application collectors
Native Roku Media Player
Roku Collector
The Native Roku Media Player is a configuration option for the Roku Collector by Datazoom that makes the following additional data points automatically collectable in real time.
Data Points
Events
Discrete occurrences driven by user interactions or system actions
Metadata
CMCD
Attributes
User
Fluxdata
Metrics measuring changing parameters over time
-
Bandwidth
-
Buffer Duration
-
Buffer Duration - Content
-
Content Session Start Timestamp
-
Current Audio Track
-
Current Subtitles
-
Number of Content Plays
-
Number of Content Requests
-
Number of Errors
-
Number of Errors - Content
-
Pause Duration
-
Pause Duration - Content
-
Playback Duration
-
Playback Duration - Content
-
Player State
-
Playhead Position
-
Rendition Audio Bitrate
-
Rendition Height
-
Rendition Name
-
Rendition Video Bitrate
-
Rendition Width
-
Stall Count
-
Stall Count - Content
-
Stall Duration
-
Stall Duration - Content
-
Time Since Content Request
-
Time Since Content Started
-
Time Since Last Buffer Start - Content
-
Time Since Last Heartbeat
-
Time Since Last Milestone - Ad
-
Time Since Last Milestone - Content
-
Time Since Last Pause
-
Time Since Last Seek Start
- Time Since Last Stall Start - Content
Ad frameworks
Integration instructions
Adding dependencies to your project
Roku Plugin for Eclipse IDE Clone the latest version of the repository: Extract the components folder from latest version of the cloned repository Copy the components folder in your channel project. We assume that: The developer had already created a Roku project (in Eclipse IDE). 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. This project contains the base and native-collector library (inside DzLib folder). Copy the following in MainScene.brs (in components folder) or in the brs file you intend to configure the collector library. Once the collector is successfully instantiated we can set desired console log level for the collector instance: 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 DzCollector() will call the above function when initialized. IMPORTANT! To confirm Datazoom SDK is successfully initialized and can be safely attached to player and start collecting data or fire custom events you MUST use following callback: or check following field: 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. 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: To set Custom Metadata for player session we use following method: 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: For player Custom Metadata: We delete Custom Metadata that are set for session and player by using this methods: For session Custom Metadata: For player Custom Metadata: Also, we can send Custom Events to the Datazoom SDK using following methods: We can also add Custom Metadata to generated Custom Event. Metadata sent using this method will be sent with the custom event only. Now, after we create player instance we can add player to Datazoom SDK and your xml file should look like this: Change <Player ID> as per the requirement. Now add the following function for initializing player to Datazoom SDK: DzPlayer() will call the above function when initialized. Optionally, At this point Datazoom SDK is fully initialized with player. Selected data points will be collected from player and sent to collector service. If Roku RAF is enabled and implemented in your app please use following method to pass CTX object to DZ SDK: You can download Datazoom Roku DEMO app which demonstrates above methods from here : Follow instructions in provided Readme.md file for importing demo project to Eclipse. Your-Project(Right click) > Export > BrightScript > BrightScript Deployment >[Change File name/path, if needed (.zip)] > Finish Open browser and go to Roku's local network IP address.(eg: 192.168.0.9). Provide username and password of developer mode. Click upload and select the newly created zip file. Click install. The channel will automatically start playing. This channel can also be played by-> go to Roku menu, select the Roku developer channel and play. To view the data points generated by Roku, go to Linux terminal and type telnet <Roku's Local IP> 8085
For Roku plugin installation and usage in Eclipse IDE
https://sdkdocs.roku.com/display/sdkdoc/Roku+Plugin+for+Eclipse+IDEInstallation Instructions
git clone https://gitlab.com/datazoom/roku/dz_collector_roku_release.git
eg: /<your project>/components/DzLibConfiguring collector library in channel
In Sub/function init(), add the followingm.player = m.top.findNode("<Player ID>")
m.DzLib = m.top.findNode("DzLib")
DzCollector()
m.DzLib.callFunc("setLogLevel","info")
Sub DzCollector()
m.DzLib.libConfiguration = {
configURL : "<url given by Datazoom>",
configId: "<configuration id from Datazoom>"
}
m.DzLib.initiateCollector = true
End Sub
m.DzLib.observeField("connectionSuccess", "datazoomSDKInitialized")
m.DzLib.connectionSuccess '(true/false)
<DzLib id="DzLib" />
Custom Events and Custom Metadata
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" })
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" })
customSessionMeta = m.DzLib.callFunc("getDZSessionMeta")
customSessionMeta = m.DzLib.callFunc("getDZPlayerMeta")
m.DzLib.callFunc("rmDZSessionMeta")
m.DzLib.callFunc("rmDZPlayerMeta")
m.DzLib.callFunc("generateDatazoomEvent","SOME CUSTOM EVENT")
m.DzLib.callFunc("generateDatazoomEvent", "SOME CUSTOM EVENT", {customEventMetaKeyDict1 : "CustomEventMetaValueDict1", customEvemtMetaKeyDict2 : "CustomEventMetaValueDict2", customEventMetaKeyDictNth : "CustomEventMetaValueDictNth"})
Add the following inside <children> in MainScene.xml or in the xml file you intend to configure the collector library.<Video id="<Player ID>" />
<children>
<DzLib id="DzLib" />
<Video id="<Player ID>" />
</children>
Sub DzPlayer()
m.DzLib.playerInit = {
player: m.video
}
m.DzLib.initiatePlayer = true
End Sub
m.DzLib.playerInit
can include a noContentObserver
field which, if set to true
, will prevent the collector from observing the video node’s content metadata for the purpose of creating content sessions automatically. This may be useful for apps who prefer to manage content sessions explicitly through the setting of m.DzLib.initiatePlayer
. The following demonstrates such a use case:Sub DzPlayer()
m.DzLib.playerInit = {
player: m.video,
noContentObserver: true
}
m.DzLib.initiatePlayer = true
End Sub
Roku RAF
m.DzLib.callFunc("generateAdEvent",adCtx)
git clone https://gitlab.com/datazoom/roku/roku-native-demo.git
Instructions to create a compiled zip file
eg: - telnet 192.168.0.9 8085