audioplayer
v3.1.4
Published
HTML5 Client Side Audio Player
Downloads
31
Readme
audioplayer
Client-side HTML5 audio player library inspired by Amazing Audio Player (https://amazingaudioplayer.com/).
Features:
- using pure HTML5 Audio API (see: http://caniuse.com/#feat=audio)
- custom player controls look&feel thanks to SCSS variables
- optional track list
- support for multiple controls on one page
Library exports 3 Javascript classes:
- Audio (audio player API)
- Panel (renders HTML with player controls)
- Tracks (renders HTML with tracks)
Example code:
import $ from "jquery";
import {Panel, Audio} from 'audioplayer';
$(function() {
// Pure HTML5 audio player (no visual controls, just API)
let audio = new Audio();
// Generate player controls
let $playerEl = $('#player'); // Controls container
let panel = new Panel($playerEl, audio);
panel.load({ // Set audio track
src: "https://amazingaudioplayer.com/wp-content/uploads/amazingaudioplayer/10/audios/Soaring Spirit.mp3",
title: "Soaring Spirit",
duration: "2:10"
});
panel.play(); // Auto play
});
Full demo app: https://bitbucket.org/marc1n/jslib-audioplayer-demo
Installation
npm install audioplayer
(npm package homepage: https://www.npmjs.com/package/audioplayer)
MIT License