@gasparnd/mediaplayer

1.0.1 • Public • Published

#Media Player Plugin An extensible media player plugin. Allows mute, autoplay and auto pause videos

Install

npm i @gasparnd/mediaplayer

Build 🛠️

The project was created with TypeScript ##Start 🚀 For includes the plugin in your project, you should:

  • Import

import MediaPlayer from '@gasparnd/mediaplayer'; import AutoPlay from '@gasparnd/mediaplayer/lib/plugins/AutoPlay'; import AutoPause from '@gasparnd/mediaplayer/lib/plugins/AutoPause'; import Ads from '@gasparnd/mediaplayer/lib/plugins/Ads/index'; });

  • Instance the Class, the video and his plugins how parrams

const video = document.querySelector('video'); const player = new MediaPlayer({ el: video, plugins: [new AutoPlay(), new AutoPause(), new Ads()]

  • Create the events

video.onclick = () => player.playToggle(); const muteBTN: HTMLElement = document.querySelector('#muteButton'); muteBTN.onclick = () => player.muteToggle();

Readme

Keywords

none

Package Sidebar

Install

npm i @gasparnd/mediaplayer

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

9.29 kB

Total Files

7

Last publish

Collaborators

  • gasparnd