universal-video-api
v1.1.0
Published
git push -u origin master
Downloads
10
Maintainers
Readme
Universal Video Player API
This module provides a universal API for controlling YouTube, Vimeo, MediaElement.js, Plyr and Video Element players.
Supported Methods
- play
- pause
- stop
- mute
- unmute
Supported Events
- play
- pause
- ended
Install
npm install universal-vide-api --save-dev
Usage
const video = document.getElementById("video");
const videoElement = new VideoElement(video);
videoElement.setup(() => {
// events
videoElement.on("play", () => console.log("play"));
videoElement.on("pause", () => console.log("pause"));
videoElement.on("ended", () => console.log("ended"));
// methods
videoElement.play();
videoElement.pause();
videoElement.stop();
videoElement.mute();
videoElement.unmute();
});