audiojs / contributing

Discussion and guidelines for contributing
2 stars 0 forks source link

audio-play #23

Closed dy closed 7 years ago

dy commented 7 years ago

We need simple component for easy audio-buffer previews, I suggest the folllowing API:

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

//play audio buffer with possible options
let playback = play(audioBuffer, {
    //repeat - bool or number for exact number of repeats
    repeat: false,

    //start/end time, can be negative
    start: 0,
    end: -0,

    //playback rate
    rate: 1,

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

    //volume
    volume: 1,

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

    //start playing immediately
    autoplay: true
});

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

//or just 
let play = playback, pause;
pause = play();
play = pause();

The component is eventually will be used by audiojs/audio.

The problem is that audio-play is taken by former play-audio, whereas play-audio is free-like.

I am going to write to @npm and @deathcap to resolve this, if possible, to make swapping.