1.3.1 • Published 5 years ago

h5-audio-controls v1.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

H5 Audio Controls

NPM version David deps devDependencies Status npm download jsdelivr npm license

This package has been deprecated

This package has been migrated to @cycjimmy/h5-audio-controls for scoped NPM package. Please switch to @cycjimmy/h5-audio-controls to stay up to date.

How to use

Install

$ npm install h5-audio-controls --save
# or
$ yarn add h5-audio-controls

Usage

import H5AudioControls from 'h5-audio-controls';
# OR
let H5AudioControls = require('h5-audio-controls');
new H5AudioControls(audioSrc [, options])
  • audioSrc: string a url to an audio file
  • The options supports:

    • context: string|element the context of audio controller. Default document.body.
    • position: string the position of audio controller.
      • Choose one of the four options:
        • 'left-top'
        • 'top-right'(Default)
        • 'right-bottom'
        • 'left-bottom'
    • buttonSize: string|number Set button wrapper size. Default ''
    • picSize: string|number Set button picture size. Default ''
    • autoPlay: boolean Whether to play immediately after loading. Default true
  • H5AudioControls instance supports the following methods:

    • load(): init controller.
    • play(): play the audio.
    • pause(): pause the audio.
    • stop(): stop the audio.

Use in browser

<script src="H5AudioControls.min.js"></script>
<script>
  var audioSrc = '../media/test_audio.mp3';
  new H5AudioControls(audioSrc).load();
</script>

CDN

To use via a CDN include this in your html:

<script src="https://cdn.jsdelivr.net/npm/h5-audio-controls@1/build/H5AudioControls.min.js"></script>
1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago