audio-controls

1.0.6 • Public • Published

Audio Controls

Connect events (play, pause, previous, next) from PlayQueue or the Audio element to HTML elements.

Install

npm install audio-controls

Usage

  import {AudioControls} from 'audio-controls';
    
  const audioControls = new AudioControls({
    'playQueue': playQueue, // optional if audio is provided
    'audio': audioObject, // optional if playQueue is provided
    'playPause': '#control-play-pause',
    'previous': '#control-previous',
    'next': '#control-next'
  });

Example HTML

  <div class="controls">
    <div class="control previous" id="control-previous"></div>
    <div class="control play-pause" id="control-play-pause"></div>
    <div class="control next" id="control-next"></div>
  </div>

Build

Watch JS and LESS files

npm run dev

Rollup JS and LESS files

npm run build

Run the example To run it, you'll need a webserver. I recommend https://www.npmjs.com/package/http-server. After installing it run http-server and open a browser to http://localhost:8080/example/.

Readme

Keywords

none

Package Sidebar

Install

npm i audio-controls

Weekly Downloads

10

Version

1.0.6

License

none

Unpacked Size

16.3 kB

Total Files

5

Last publish

Collaborators

  • dankantor