Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@10up/component-audio

Package Overview
Dependencies
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@10up/component-audio

Accessible audio component.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
7
Weekly downloads
 
Created
Source

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.

PropertyDefault valueTypeUsage
playLabelPlayStringLabel for the play button
playLabelStopStringLabel for the stop button
stopLabelStopStringLabel for the pause button
pauseLabelPauseStringLabel for the mute button
muteLabelMuteStringLabel for the mute button
volumeLabelVolumeStringLabel for the volume slider
scrubberLabelScrub TimelineStringLabel for the scrubber slider
currentTimeLabelTotal TimeStringLabel for the total time
showMutetrueBooleanMaybe show the mute button
showStoptrueBooleanMaybe show the stop button
showTimertrueBooleanMaybe show the timer control
showVolumetrueBooleanMaybe show the volume slider
showScrubbertrueBooleanMaybe show the scrubber control
localStoragetrueBooleanMaybe enable localStorage. This allows a user to reload the page, and pickup where they last left off.
debugtrueBooleanMaybe 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?

FAQs

Package last updated on 19 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc