Socket
Socket
Sign inDemoInstall

audio-play

Package Overview
Dependencies
44
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    audio-play

Play audio buffer in node or browser


Version published
Weekly downloads
346
increased by37.3%
Maintainers
6
Install size
688 kB
Created
Weekly downloads
 

Readme

Source

audio-play Build Status unstable Greenkeeper badge

Play audio buffer, browser/node-wise.

Usage

npm install audio-play

const play = require('audio-play');
const load = require('audio-loader');

load('./sample.mp3').then(play);

API

const play = require('audio-play');

//play audio buffer with possible options
let pause = play(audioBuffer, {
  //start/end time, can be negative to measure from the end
  start: 0,
  end: audioBuffer.duration,

  //repeat playback within start/end
  loop: false,

  //playback rate
  rate: 1,

  //fine-tune of playback rate, in cents
  detune: 0,

  //volume
  volume: 1,

  //device (for use with NodeJS, optional)
  device: 'hw:1,0',

  //possibly existing audio-context, not necessary
  context: require('audio-context'),

  //start playing immediately
  autoplay: true
}, onend?);

//pause/continue playback
play = pause();
pause = play();

//or usual way
let playback = play(buffer, opts?, cb?);
playback.pause();
playback.play();

//get played time
playback.currentTime;
  • audio-loader — load AudioBuffer from any audio source.
  • audio-decode — decode audioBuffer

Keywords

FAQs

Last updated on 30 Jan 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc