Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/streamroot/video-event-polyfill
Polyfill for unconsistent events of HTML5 video API
https://github.com/streamroot/video-event-polyfill
Last synced: 4 months ago
JSON representation
Polyfill for unconsistent events of HTML5 video API
- Host: GitHub
- URL: https://github.com/streamroot/video-event-polyfill
- Owner: streamroot
- Archived: true
- Created: 2015-12-22T10:23:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-31T12:28:03.000Z (over 7 years ago)
- Last Synced: 2024-06-22T19:42:20.996Z (6 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 9
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# video-event-polyfill
Polyfill for unconsistent events of HTML5 video API## Installation
```sh
npm install --save video-event-polyfill
```## Build
The dist file is generated with the following command:
```sh
npm run build
```# Basic Usage
``` js
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](https://github.com/streamroot/video-event-polyfill/blob/master/lib/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