Video analytics client for mave.io
npm install @maveio/dataPrivacy-friendly video analytics client for mave.io.
Install the package within your project:
``bash`
npm install @maveio/data
Initialize the client with your configuration:
`javascript
import { Metrics } from '@maveio/data';
// Configure the ingestion endpoint
Metrics.config = {
apiEndpoint: 'https://metrics.video-dns.com/v1/events', // or adjust to your URL
};
`
To collect video events, create a Metrics instance for each HTMLVideoElement (or hls.js instance).
`javascript`
new Metrics('#my_video', 'ubg50LeDE9v86ye').monitor();
The embed_id acts as a unique identifier for the video content.
When using hls.js, pass the hls instance directly:
`javascript
const hls = new Hls();
// ... setup hls ...
new Metrics(hls, 'ubg50LeDE9v86ye').monitor();
`
This repository includes a standalone example page in examples/video/index.html.
1. Build the package:
`bash`
npm install
npm run build
2. Serve the example page:
`bash``
# Proxies events to a local Core instance by default (http://localhost:4000)
npm run example
# Or specify a custom Core URL:
MAVE_CORE_BASE_URL=https://your-core-url.com npm run example