Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Polyfill for unconsistent events of HTML5 video API

Notifications You must be signed in to change notification settings

streamroot/video-event-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

video-event-polyfill

Polyfill for unconsistent events of HTML5 video API

Installation

npm install --save video-event-polyfill

Build

The dist file is generated with the following command:

npm run build

Basic Usage

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

API

Constructor

Takes a html5 video tag as argument

Events

Static enum for the events emulated by this polyfill (see eventStruct.js )

on(Event, callback)

Takes an Event from the previous Enum, and a callback

setLive(true|false)

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.

dispose()

Destroy the polyfill

About

Polyfill for unconsistent events of HTML5 video API

Resources

Stars

Watchers

Forks

Packages

No packages published