@pragli/audio-play
@pragli/audio-play
npm i @pragli/audio-play
@pragli/audio-play

@pragli/audio-play

Play audio buffer in browser/node

by audiojs

2.3.2 (see all)License:MITTypeScript:Not Found
npm i @pragli/audio-play
Readme

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;

Downloads/wk

15

GitHub Stars

60

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

6

OPEN ISSUES

14

OPEN PRs

0
VersionTagPublished
2.3.2
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate