@phongthien/ssai-tracking
v0.0.5
Published
**Table of Contents**
Downloads
5
Readme
ssai-tracking
Table of Contents
Install
npm i @sigmaott/ssai-tracking
Usage
import SSAITracking from '@sigmaott/ssai-tracking'
const video = document.getElementById('video')
// get tracking url and source
const domain = `<<domain>>`
const sessionUrl = `${domain}/manifest/manipulation/session/628e8331-d3b2-4e89-a151-10003ed76286/origin04/scte35-av4s-clear/master.m3u8`
const data = await fetch(sessionUrl)
.then(response => response.json()) as { manifestUrl: string; trackingUrl: string }
const videoSrc = `${domain}${data.manifestUrl}`const trackingUrl = `${domain}${data.trackingUrl}`
// init tracking before play video
const ssaiPlugin = new SSAITracking({ trackingUrl, video, intervalTracking: 10000 })
ssaiPlugin.init()
//destroy before not use
ssaiPlugin.destroy()
API
SSAITracking.constructor(params:Obj)
Call when init instance.
| Name | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | params | Obj | true | | Setting params when init instance. |
supported params:
| Name | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | trackingUrl | string | true | | Url tracking | | video | HTMLVideoElement | true | | HTMLVideoElement | | intervalTracking | number | true | 10000 | Interval tracking (unit: ms ) | | disableErrLog | boolen | false | false | if value is false enable log when call api error |
SSAITracking.init()
Call before play video.
SSAITracking.destroy()
Call before not use instance