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

Latest commit

 

History

History
54 lines (35 loc) · 1.1 KB

README.md

File metadata and controls

54 lines (35 loc) · 1.1 KB

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