Datazoom is a high-availability real-time data collection solution. This document summarizes how to integrate the Amazon Interactive Video Service 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 AWS IVS Player 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 line into your HTML
Replace the
CONFIG_ID
value with Collector configuration id.
This inserts Datazoom's data collection SDK into the page.
Include the following tag (for the latest version of the AWS IVS player).
<script src="https://player.live-video.net/1.16.0/amazon-ivs-player.min.js"></script>
Activate Data Collection for an AWS IVS Player
To activate data collection for an AWS IVS Player instance, create a Datazoom context which references the player instance with the following snippet:
datazoom_context = datazoom.createContext(aws_ivs_player);
For example:
<html> <head> <!-- THE AWS IVS SCRIPT --> <script src="https://player.live-video.net/1.16.0/amazon-ivs-player.min.js"></script> <!-- THE DATAZOOM BEACON SCRIPT --> <script src='https://platform.datazoom.io/beacon/v1/config?configuration_id=CONFIG_ID'></script> </head> <body> <!-- THE VIDEO PLAYER --> <div> <video id="video" style="width:50%;height:50%" controls></video> </div> <script> var aws_ivs_player; var datazoom_context; var url = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"; // Create a Player instance if (IVSPlayer.isPlayerSupported) { aws_ivs_player = IVSPlayer.create(); aws_ivs_player.attachHTMLVideoElement(document.getElementById("video")); aws_ivs_player.load(url); // Activates data collection datazoom_context = datazoom.createContext(aws_ivs_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 (aws_ivs_player) { aws_ivs_player.delete(); aws_ivs_player = null; } if (datazoom_context) { datazoom_context.destroy(); datazoom_context = null; }
Comments
0 comments
Article is closed for comments.