Version : 1.0.4
Organization : Thủ Đô Multimedia
This document serves as a guide for integrating and using the SSAI SDK for SmartTV applications. It includes detailed information on installation, SDK initialization, and handling necessary callbacks.
This document is intended for developers who want to integrate the SSAI SDK into their SmartTV applications, focusing on ad tracking and video streaming functionalities.
Platform | Support version |
---|---|
Samsung Tizen | Tizen 3.0 (2017 Models) or above |
LG WebOS | WebOS 3.0 (2016-2017 Models) or above |
To install the SSAI SDK, follow these steps:
- Import script
<script src='sigma-dai.obs.min.js'></script>
The sigma.dai
parameters are used to send information to the ads server via the query string of the MANIFEST_URL
. These parameters help customize and enable server-side ad insertion (SSAI) features.
sigma.dai.<param>=<value>
Parameters are appended to the MANIFEST_URL
as key-value pairs prefixed with sigma.dai
.
-
sigma.dai.adsEndpoint
This parameter specifies the adsEndpoint of the ads server. It is mandatory to include this parameter for the SSAI functionality.Example: MANIFEST_URL=https://stream.example.com/master.m3u8?sigma.dai.adsEndpoint=ADS_ENDPOINT
Additional parameters can be included to personalize the request or provide extra context to the ads server.
- Install Hls
<script src='https://cdn.jsdelivr.net/npm/hls.js@1'></script>
- Initialize hls instance
const hls = new Hls();
hls.attachMedia(document.getElementById(VIDEO_ELEMENT_ID));
- Initialize SSAI SDK instance :
const smDaiManager = new SmDaiManager();
smDaiManager.setManifestUrl(MANIFEST_URL); // Set the URL with SSAI-related query parameters
- Attach hls instance into SSAI SDK instance :
smDaiManager.attachHls(hls, Hls);
- Call loadSource method :
hls.loadSource(MANIFEST_URL);
- The
TRACKING
event provides information about ad playback progress and tracking-related data.
smDaiManager.on(SmDaiManager.Events.TRACKING, (event, data) => {
console.log('TRACKING ', event, data);
});
When the SDK instance is no longer needed, call destroy to release resources:
smDaiManager.destroy();
Props | Type | Description |
---|---|---|
MANIFEST_URL | String | The URL to the HLS Multivariant Playlist (M3U8) file, including query parameters for SSAI. |
VIDEO_ELEMENT_ID | String | The ID of the HTML5 video element where the video stream will be displayed. |
ADS_ENDPOINT | String | The end point of the ads |
By following the steps outlined in this guide, you can effectively integrate and utilize the SSAI SDK within your SmartTV application.