npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cycjimmy/h5-audio-controls

v5.0.5

Published

Simple h5 music controller

Downloads

472

Readme

H5 Audio Controls

libraries dependency status libraries sourcerank Coverage Status Release date rollup semantic-release jest npm license

  • Simple h5 music controller Demo

How to use

Install

NPM version NPM bundle size npm download

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

Usage

import h5AudioControls from '@cycjimmy/h5-audio-controls';
# OR
const h5AudioControls = require('@cycjimmy/h5-audio-controls');
h5AudioControls(audioSrc [, options])
  • audioSrc: [Require][string] a url to an audio file

  • The options supports:

    • context: [Option][string|element] the context of audio controller. Default document.body.
    • position: [Option][string] the position of audio controller.
      • Choose one of the four options:
        • 'left-top'
        • 'top-right'(Default)
        • 'right-bottom'
        • 'left-bottom'
    • positionType: [Option][string] Set position type of audio controller.
      • Choose one of the five options:
        • 'fixed'(Default)
        • 'absolute'
        • 'relative'
        • 'sticky'
        • 'static'
    • buttonSize: [Option][string|number] Set button wrapper size.
    • iconSize: [Option][string|number] Set button icon size.
    • playIcon: [Option][string] Set play icon.
    • pauseIcon: [Option][string] Set pause icon.
    • autoPlay: [Option][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.
    • isPlaying(): Return whether the audio is playing.
    • changeAudioSrc(src): Dynamically modify the value of audioSrc.
    • changePosition(position): Dynamically modify the value of position.
    • changeButtonSize(size): Dynamically modify the value of buttonSize.
    • changeIconSize(size): Dynamically modify the value of iconSize.
    • change(key, val): Dynamically change the value of configuration properties.
      • Supports the following keys:
        • 'audioSrc': Change the value of audioSrc. change('audioSrc', 'yourSrc') is the same as changeAudioSrc('yourSrc')
        • 'position': Change the value of position. change('position', 'left-top') is the same as changePosition('left-top')
        • 'buttonSize': Change the value of buttonSize. change('buttonSize', '16vw') is the same as changeButtonSize('16vw')
        • 'iconSize': Change the value of iconSize. change('iconSize', '10vw') is the same as changeIconSize('10vw')
        • 'playIcon': Change the value of playIcon.
        • 'pauseIcon': Change the value of pauseIcon.
        • 'autoPlay': Change the value of autoPlay.

Use in browser

<script src="h5-audio-controls.umd.min.js"></script>
<script>
  var audioSrc = '../media/test_audio.mp3';
  h5AudioControls(audioSrc).load();
</script>

CDN

jsdelivr

To use via a CDN include this in your html:

<script src="https://cdn.jsdelivr.net/npm/@cycjimmy/h5-audio-controls@5/dist/h5-audio-controls.umd.min.js"></script>