Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
api.load = function (sound, html5, onload_cb, onerror_cb) {
var urls = [];
if (typeof(this.audioFormats) === "undefined" || this.audioFormats.length === 0) {
throw new Error("target audio extension(s) should be set through me.audio.init() before calling the preloader.");
}
for (var i = 0; i < this.audioFormats.length; i++) {
urls.push(sound.src + sound.name + "." + this.audioFormats[i] + me.loader.nocache);
}
audioTracks[sound.name] = new Howl({
src : urls,
volume : Howler.volume(),
html5 : html5 === true,
xhrWithCredentials : me.loader.withCredentials,
/**
* @ignore
*/
onloaderror : function () {
soundLoadError.call(me.audio, sound.name, onerror_cb);
},
/**
* @ignore
*/
onload : function () {
retry_counter = 0;
if (onload_cb) {
onload_cb();
}
setVolume(floatVolume) {
console.log('SET MAINVOLUME', floatVolume);
Howler.volume(floatVolume);
}
setGlobalVolume: (volume) => {
Howler.volume(parseFloat(volume) * 0.01)
return {
type: constants.SET_GLOBAL_VOLUME,
payload: {
globalVolume: volume
}
}
},
nextTutStep: () => {
handleChange(e){
e.preventDefault();
const localVolume = parseInt(e.target.value);
const howlerVolume = localVolume / 10;
this.setState({volume: localVolume});
this.props.updateVolume(howlerVolume);
Howler.volume(howlerVolume)
}
updateVol() {
Howler.volume([this.vol])
}
}
onvolume() {
music.state.volume = Howler.volume()
}
})