universal-video-api

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i universal-video-api

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

160 kB

Total Files

17

Last publish

Collaborators

  • averta