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

@10up/component-audio

v0.4.0

Published

Accessible audio component.

Downloads

17

Readme

NOTE: This is a very initial pass. Recommend waiting on first usage until fully tested. Updates coming shortly.

10up Audio component

Support Level License: MIT Build Status

Installation

NPM

npm install --save @10up/component-audio

Standalone

Clone this repo and import audio.js and audio.css from the dist/ directory.

Methods

The following lists the latest supported callbacks. Each callback receives an instance of the player.

onplay

Fires when the audio has been started or is no longer paused

onplay: (playerInstance) => {}

onpause

Fires when the audio/video has been paused

onpause: (playerInstance) => {}

onerror

Fires when an error occurred during the loading of an audio

onerror: (playerInstance) => {}

onloadstart

Fires when the browser starts looking for the audio

onloadstart: (playerInstance) => {}

onended

Fires when the current playlist is ended

onended: (playerInstance) => {}

onplaying

Fires when the audio is playing after having been paused or stopped for buffering

onplaying: (playerInstance) => {}

onprogress

Fires when the browser is downloading the audio

onprogress: (playerInstance) => {}

onseeking

Fires when the user starts moving/skipping to a new position in the audio

onseeking: (playerInstance) => {}

onseeked

Fires when the user is finished moving/skipping to a new position in the audio

onseeked: (playerInstance) => {}

ontimeupdate

Fires when the current playback position has changed

ontimeupdate: (playerInstance) => {}

onvolumechange

Fires when the volume has been changed

onvolumechange: (playerInstance) => {}

Properties

The following is a list of optional properties, their types and usages.

| Property | Default value | Type | Usage | |-|-|-|-| | playLabel | Play | String | Label for the play button | | playLabel | Stop | String | Label for the stop button | | stopLabel | Stop | String | Label for the pause button | | pauseLabel | Pause | String | Label for the mute button | | muteLabel | Mute | String | Label for the mute button | | volumeLabel | Volume | String | Label for the volume slider | | scrubberLabel | Scrub Timeline | String | Label for the scrubber slider | | currentTimeLabel | Total Time | String | Label for the total time | | showMute | true | Boolean | Maybe show the mute button | | showStop | true | Boolean | Maybe show the stop button | | showTimer | true | Boolean | Maybe show the timer control | | showVolume | true | Boolean | Maybe show the volume slider | | showScrubber | true | Boolean | Maybe show the scrubber control | | localStorage | true | Boolean | Maybe enable localStorage. This allows a user to reload the page, and pickup where they last left off. | | debug | true | Boolean | Maybe turn on debug mode. Debug mode outputs helpful information in the console window of the browser. |

Usage

This is the markup template expected by the component. Use an HTML audio player, wrapped with an element containing a class. Here we use a div with a class of 'audio'.

Markup

<div class="audio">
   <audio controls>
   	<source src="path/to/audio-file.mp3" type="audio/mpeg">
   	Your browser does not support the audio element.
   </audio>
</div> <!-- //.audio -->

JavaScript

Create a new instance by supplying the selector to use for the audio and an object containing any necessary callback functions.

import Audio from '@10up/component-audio';

const audioInstance = new Audio( '.audio', { ...options } );

CSS

Coming soon

Demo

Coming soon

Tests

Coming soon

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Like what you see?