Privacy-friendly video analytics client for mave.io.
Install the package within your project:
npm install @maveio/dataInitialize the client with your configuration:
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).
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:
const hls = new Hls();
// ... setup hls ...
new Metrics(hls, 'ubg50LeDE9v86ye').monitor();This repository includes a standalone example page in examples/video/index.html.
-
Build the package:
npm install npm run build
-
Serve the example page:
# 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