Application collectors
Shaka Media Player
v2.26.0 • For the Javascript Collector
The Shaka Media Player Extension is a configuration option for the Javascript Collector by Datazoom that makes the following additional data points automatically collectable in real time.
Integration Instructions
Datazoom provides plugins for data collection through our Beacon Services. Integrate the Shaka Player plugin into your web application with the following snippet: Insert this JS line into your HTML Replace the This inserts Datazoom's data collection SDK into the page. The Shaka Player plugin can be integrated into your HTML along with additional parameters. For example, the Normally the CMCD data, if enabled, are transmitted to CDN as query strings on each of the request URLs. By specifying The CDN must be configured to support CORS preflight requests, in order to allow CMCD headers. The Activate data collection by passing player instance only. for example: Activate data collection by passing player instance and controls instance for example: Once the Datazoom context object is initialized, normally the collector will start content session automatically when it detects the intent to start playback, based on listener-events from the player. However, in cases where this auto detection of content session start being inaccurate (for example, with Shaka player the HTML5 video If the data collection must be stopped for any reason, for example after the destruction of the corresponding player instance, invoke the We have made it convenient to manage your Shaka Collector integration by providing NPM (Node Package Manager) support. Please see installation details here. Shaka Player API Doc : https://shaka-player-demo.appspot.com/docs/api/tutorial-welcome.html Plugin Integration
<script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script>
CONFIG_ID value with the collector configuration ID.Additional Parameters
cmcd_mode parameter overrides the mode of transmitting CMCD data to CDN:<script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID&cmcd_mode=header'></script>
header for the cmcd_mode parameter as above, the same data are transmitted to CDN as HTTP headers instead.CONFIG_ID value above should be replaced with the collector configuration ID as usual.Activate Data Collection for a Shaka Player
context = datazoom.createContext(player);
<!DOCTYPE html>
<html lang="en">
<head>
<title>Shaka Player Test Video</title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/shaka-player/3.1.0/controls.css">
<!-- THE SHAKA PLAYER CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/3.1.0/shaka-player.ui.js"></script>
<!-- THE DATAZOOM BEACON SCRIPT -->
<script src="https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID"></script>
</head>
<body>
<p>
This example demonstrates the basic use of the Datazoom SDK with the SHAKA
player
</p>
<div data-shaka-player-container style="max-width: 40em" data-shaka-player-cast-receiver-id="1BA79154">
<video data-shaka-player id="video" style="width: 100%; height: 100%"></video>
</div>
<script>
async function initPlayer() {
var video_url = "https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"
const video = document.getElementById("video");
var ui = video["ui"];;
// Create a Controls instance.
var controls = ui.getControls();
// Create a Player instance.
var player = controls.getPlayer();
window.player = player;
//Activates data collection
datazoom.createContext(player);
try {
await player.load(video_url);
// This runs if the asynchronous load is successful.
console.log("The video has now been loaded!");
} catch (e) {
// onError is executed if the asynchronous load fails.
onError(e);
}
}
function initApp() {
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll();
// Check to see if the browser supports the basic APIs Shaka needs.
if (shaka.Player.isBrowserSupported()) {
// Everything looks good!
document.addEventListener('shaka-ui-loaded', initPlayer);
} else {
// This browser does not have the minimum set of APIs we need.
console.error("Browser not supported!");
}
}
function onErrorEvent(event) {
// Extract the shaka.util.Error object from the event.
onError(event.detail);
}
function onError(error) {
// Log the error.
console.log("Error code", error.code, "object", error);
}
initApp();
</script>
</body>
</html>
context = datazoom.createContext({
player: my_player,
controls: my_controls
});
<!DOCTYPE html>
<html lang="en">
<head>
<title>Shaka Player Test Video</title>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/shaka-player/3.1.0/controls.css">
<!-- THE SHAKA PLAYER CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/3.1.0/shaka-player.ui.js"></script>
<!-- THE DATAZOOM BEACON SCRIPT -->
<script src="https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID"></script>
</head>
<body>
<p>
This example demonstrates the basic use of the Datazoom SDK with the SHAKA
player
</p>
<div data-shaka-player-container style="max-width: 40em" data-shaka-player-cast-receiver-id="1BA79154">
<video data-shaka-player id="video" style="width: 100%; height: 100%"></video>
</div>
<script>
async function initPlayer() {
const video = document.getElementById("video");
var video_url = "https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"
var ui = video["ui"];
// Create a Controls instance.
var my_controls = ui.getControls();
// Create a Player instance.
var my_player = my_controls.getPlayer();
window.my_player = my_player;
datazoom.createContext({
player: my_player,
controls: my_controls
});
try {
await my_player.load(video_url);
// This runs if the asynchronous load is successful.
console.log("The video has now been loaded!");
} catch (e) {
// onError is executed if the asynchronous load fails.
onError(e);
}
}
function initApp() {
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll();
// Check to see if the browser supports the basic APIs Shaka needs.
if (shaka.Player.isBrowserSupported()) {
// Everything looks good!
document.addEventListener('shaka-ui-loaded', initPlayer);
} else {
// This browser does not have the minimum set of APIs we need.
console.error("Browser not supported!");
}
}
function onErrorEvent(event) {
// Extract the shaka.util.Error object from the event.
onError(event.detail);
}
function onError(error) {
// Log the error.
console.log("Error code", error.code, "object", error);
}
initApp();
</script>
</body>
</html>
Start Content Session Explicitly
play listener-events are fired after finishing loading of media data, which results in late detection of the playback intent), the Datazoom context object provides the startContentSession() method that the application can call to explicitly start a content session in a way tailored for the application. For example:// If the video should auto play
function onPageLoad() {
datazoom_context.startContentSession();
...
}
// If the video doesn't auto play
function onPlaybackButtonClick() {
datazoom_context.startContentSession();
...
}
Stop Data Collection
destroy() method of the Datazoom context object as in the following example:if (my_player) {
my_player.destroy();
my_player = null;
}
if (datazoom_context) {
datazoom_context.destroy();
datazoom_context = null;
}
NPM (Node Package Manager)
References:
CMCD Support
Datazoom provides two discrete settings that control CMCD data collection, one for a specific player event, “Media Object Request”, and one for the corresponding CDN log response.
Player Collector configuration options
Use this option to enable your configured CDN to collect and return CMCD data, contained in the CMCD node of the log line JSON
Off - no CMCD keys are passed
Lite - only the CMCD keys Session ID (sid) and Request ID (rid) are passed to the CDN via query parameter or request header with every “Media Object Request”.
Full - the full set of keys specified by the CMCD standard are passed to the CDN via query parameter or request header with every “Media Object Request”
Bitmovin and JW Player support only the “Lite” setting above
Data Pipe configuration options
Select the CMCD data points you wish to be included in content requests.
Media Object Request - The video player will emit an event called “media_object_request” that will contain the selected CMCD keys below
CMCD keys - Select the CMCD keys you wish to have included with each Media Object Request
Ad Frameworks Extensions
If your Javascript application has a media player with an ad framework, Datazoom’s Javascript Collector with a Shaka Media Player can be extended with the following ad framework extensions.
Supported Features
Supported Data Points
Events
Discrete occurrences driven by user interactions or system actions
-
Audio Track Changed
-
Buffer End
-
Buffer Start
-
Cast End
-
Cast Start
-
Cast Transfer
-
Error
-
Exit Fullscreen
-
Fullscreen
-
Heartbeat
-
Media Loaded
-
Media Object Request
-
Media Request
-
Milestone
-
Mute
-
Pause
-
Playback Complete
-
Playback Start
-
Player Ready
-
Playing
-
Qualified View
-
Rendition Change
-
Resize
-
Resume
-
Seek End
-
Seek Start
-
Stall End
-
Stall Start
-
Stop
-
Subtitle Change
-
Unmute
- Volume Change
Metadata
Player
Attributes
CMCD
User
Fluxdata
Metrics measuring changing parameters over time
-
Bandwidth
-
Buffer Duration
-
Buffer Duration - Content
-
Buffer Length
-
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
-
Playback Duration - Promo
-
Playback Rate
-
Player State
-
Player Viewable
-
Player Viewable Percent
-
Playhead Position
-
Playhead Position - Program Date Time
-
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
-
Time Since Last Buffer Start - Content
-
Time Since Last Heartbeat
-
Time Since Last Milestone - Content
-
Time Since Last Pause
-
Time Since Last Rendition Change
-
Time Since Last Seek Start
-
Time Since Last Stall Start
-
Time Since Last Stall Start - Content
- Volume

