api.video player analytics plugin for videojs
npm install @api.video/videojs-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
- Installation
- Method #1: requirejs
- Method #2: typescript
- Method #3: simple include in a javascript project
video.js plugin to call the api.video analytics collector.
#### Method #1: requirejs
If you use requirejs you can add the plugin as a dependency to your project with
``sh`
$ npm install --save @api.video/videojs-player-analytics
You can then use the plugin in your script:
`javascript
var videojs = require('video.js');
var { VideoJsApiVideoAnalytics } = require('@api.video/videojs-player-analytics');
videojs.registerPlugin('apiVideoAnalytics', VideoJsApiVideoAnalytics);
const player = videojs('my-video');
player.apiVideoAnalytics();
`
#### Method #2: typescript
If you use Typescript you can add the plugin as a dependency to your project with
`sh`
$ npm install --save @api.video/videojs-player-analytics
You can then use the plugin in your script:
`typescript
import videojs from 'video.js';
import { VideoJsApiVideoAnalytics } from '@api.video/videojs-player-analytics';
videojs.registerPlugin('apiVideoAnalytics', VideoJsApiVideoAnalytics);
const player = videojs('my-video');
player.apiVideoAnalytics();
`
#### Method #3: simple include in a javascript project
Include the plugin in your HTML file like so:
`html``