api.video player analytics plugin for hls.js based players
npm install @api.video/hlsjs-player-analytics  

!npm !ts
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
- Table of contents
- Project description
- Getting started
- Setup
- Code sample
- Documentation
- Module instanciation
- Instanciation example
hls.js module to call the api.video analytics collector.
Include https://unpkg.com/@api.video/hlsjs-player-analytics in your web page.
``html`
Include the module in your HTML file like so:
`html`
Then, before having instanciated Hls, instanciate a HlsJsApiVideoAnalytics object.
The HlsJsApiVideoAnalytics constructor take the following parameters:
| Parameter name | Mandatory | Type | Description |
| -------------: | --------- | ------------------------------------------- | ------------------- |
| hls | yes | Hls instance | the instance of Hls |HlsJsApiVideoAnalyticsOptions
| options | no | (see below) | optional options |
Available options (HlsJsApiVideoAnalyticsOptions):
| Option name | Mandatory | Type | Description |
| -----------: | --------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| userMetadata | no | `{ [name: string]: string }[]` | object containing metadata (see Full example below) |`
| sequence | no | {start: number; end?: number;} ` | if only a sequence of the video is going to be played |
`javascript
var hls = new Hls();
new HlsJsApiVideoAnalytics(hls, {
sequence: {
start: 10,
end: 50
},
userMetadata: {
gender: "male"
}
});
``