Skip to content

thibka/mediatrigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Media (audio or video) / Code sync class.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published