tone-manager
v0.1.0
Published
a tone sound manager for web page
Downloads
7
Readme
a tone sound manager for web page .
usage
const config = {};
let toneManager = new ToneManager([{
id: 'alert',
src: '<audio url>',
volume: 50
}, {
id: 'error',
src: '<audio url>'
}, {
id: 'warn',
src: '<audio url>',
loop: true
}], config);
toneManager.play('alert', 30);
toneManager.play('alert', {to: 60, duration: 500});
toneManager.stop('alert');
toneManager.stopAll();
toneManager.resumeAll();
toneManager.muteAll();
toneManager.unmuteAll();
// always play sound even if `stopAll`/`muteAll` invoked ,
// but `loop` prop is disabled
toneManager.audit('warn', 50);
config
| Name | Type | Default | Description |
| -------- | ------------------ | ------------- |------------- |
| playMode | all|pageshow
| all
| if playMode is pageshow, page will only play sound in visible |