@thibka/mediatrigger

2.0.5 • Public • Published

Description

This class allows callback functions to be triggered at specific time points in an audio or video file. Time points can be defined in seconds or percents. Each callback is triggered only once.

Install

ES5

<script src="https://cdn.jsdelivr.net/npm/@thibka/mediatrigger@2.0.5/MediaTrigger-es5.min.js"></script>

Webpack

npm i @thibka/mediatrigger

Usage

var mediaTrigger = new MediaTrigger({
    media: document.querySelector('video'), 
    triggers: [
        ['2.5s', function(){ 
            // ...
        }], 
        ['25%', function(){ 
            // ...
        }]
    ]
});

mediaTrigger.start();
// mediaTrigger.stop();

Package Sidebar

Install

npm i @thibka/mediatrigger

Weekly Downloads

23

Version

2.0.5

License

ISC

Unpacked Size

10 kB

Total Files

5

Last publish

Collaborators

  • thibka