Polyfill for unconsistent events of HTML5 video API
npm install --save video-event-polyfill
The dist file is generated with the following command:
npm run build
var polyfill = new VideoEventPolyfill(video);
polyfill.on(VideoEventPolyfill.Events.WAITING, function () {
// Handle waiting event
});
polyfill.on(VideoEventPolyfill.Events.PLAYING, function () {
// Handle playing event
});
polyfill.on(VideoEventPolyfill.Events.ENDED, function () {
//Handle ended event
});
Takes a html5 video tag as argument
Static enum for the events emulated by this polyfill (see eventStruct.js )
Takes an Event from the previous Enum, and a callback
Inform the polyfill wether the content is live streaming or not. The polyfill won't trigger ENDED if this method hasn't been called, or if the content is live streaming.
Destroy the polyfill