Datazoom is a high-availability real-time data collection solution. This document summarizes how to integrate the dash.js video player with the Datazoom platform.
Login to Datazoom here: https://app.datazoom.io
Add a Collector as indicated here: How to add a Collector
Copy the CONFIG ID
to be used in the subsequent steps
Plugin Integration
Datazoom provides plugins for data collection through our Beacon Services. Integrate the Dash.js plugin into your web application with the following snippet:
<script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script>
Insert this JS line into your HTML
Replace the
CONFIG_ID
value with the collector configuration ID.
This inserts Datazoom's data collection SDK into the page.
Activate Data Collection for a Dash.js
To activate data collection for a Dash.js instance, create a Datazoom context which references the player instance with the following snippet:
datazoom_context = datazoom.createContext(dashjs_player);
For example:
<!DOCTYPE html> <html lang="en"> <head> <!-- THE DASHJS CDN --> <script src="https://reference.dashif.org/dash.js/latest/dist/dash.all.min.js"></script> <!-- THE DATAZOOM BEACON SCRIPT --> <script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script> </head> <body> <div> <video id="video" controls style="width:50%;height:50%"></video> </div> <script> var dashjs_player; var datazoom_context; var url = "https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd"; // Create a MediaPlayer and initialize it. dashjs_player = dashjs.MediaPlayer().create(); dashjs_player.initialize(document.getElementById("video"), url); // Activates data collection datazoom_context = datazoom.createContext(dashjs_player); </script> </body> </html>
Stop Data Collection
If the data collection must be stopped for any reason, for example after the destruction of the corresponding player instance, invoke the destroy()
method of the Datazoom context object as in the following example:
if (dashjs_player) { dashjs_player.destroy(); dashjs_player = null; } if (datazoom_context) { datazoom_context.destroy(); datazoom_context = null; }
References:
Dash.js API Doc : Getting started with the Web SDK | Dash.js Documentation
Comments
0 comments
Article is closed for comments.