Giter VIP home page Giter VIP logo

api.video-hlsjs-analytics's Introduction

badge   badge   badge npm ts

api.video hls.js analytics module

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

hls.js module to call the api.video analytics collector.

Getting started

Setup

Include https://unpkg.com/@api.video/hlsjs-player-analytics in your web page.

<script src="https://unpkg.com/@api.video/hlsjs-player-analytics"></script>

Code sample

Include the module in your HTML file like so:

<html>
    <head>
        <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
        <script src="https://unpkg.com/@api.video/hlsjs-player-analytics"></script>
    </head>
    
    <body>
        <video id="video" controls width=640 height=480></video>
    <script>
        var video = document.getElementById('video');
        
        var videoSrc = 'https://cdn.api.video/vod/vi5oDagRVJBSKHxSiPux5rYD/hls/manifest.m3u8';
        if (Hls.isSupported()) {
            var hls = new Hls();
            new HlsJsApiVideoAnalytics(hls);
            hls.loadSource(videoSrc);
            hls.attachMedia(video);
        }
    </script>
    </body>
</html>

Documentation

Module instantiation

Then, before having instantiated Hls, instantiate a HlsJsApiVideoAnalytics object.

The HlsJsApiVideoAnalytics constructor take the following parameters:

Parameter name Mandatory Type Description
hls yes Hls instance the instance of Hls
options no HlsJsApiVideoAnalyticsOptions (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

Instantiation example

var hls = new Hls();

new HlsJsApiVideoAnalytics(hls, {
    sequence: {
        start: 10,
        end: 50
    },
    userMetadata: {
        gender: "male"
    }
});

api.video-hlsjs-analytics's People

Contributors

anthony-dantard avatar dighan avatar erikkai avatar olivierapivideo avatar thibaultbee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

theplexus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.