New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

clicktone

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clicktone

ClickTone is designed to control audio playback with various settings, including volume control, callback and debug mode. It also includes iOS support.

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by533.33%
Maintainers
0
Weekly downloads
 
Created
Source

clicktone

npm GitHub package version NPM Downloads

ClickTone is designed to control audio playback with various settings, including volume control, callback and debug mode. It also includes iOS support.

850B gzipped

Demo


Install

yarn add clicktone

Import

import ClickTone from 'clicktone';

Usage

ClickTone uses the Web Audio API, which supports many audio file formats: MP3, WAV, OGG, AAC and others. Note that not all browsers support these formats.

const sound = new ClickTone({
  // file: './sound.mp3',
  file: new URL('./sound.mp3', import.meta.url).href,
  volume: 0.7,
  throttle: 100,
  callback: () => { console.log('Playback ended') },
  debug: true,
});

const play = () => sound.play();

button.addEventListener('pointerdown', play);

Options

OptionTypeDefaultDescription
filestringnoneThe URL of the audio file to be played.
volumenumber1.0Volume level for the audio playback, ranging from 0.0 (mute) to 1.0 (full volume).
callback((error?: Error) => void) | nullnullA callback function to be executed after the audio finishes playing, or if an error occurs.
throttlenumber0Minimum time (in milliseconds) between successive audio plays to prevent rapid repeat plays.
debugbooleanfalseIf true, debug information and errors will be logged to the console.

License

clicktone is released under MIT license.

Keywords

FAQs

Package last updated on 12 Feb 2025

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