Restored sound stacking in HTML5 audio backend for AJAX Chat.

This commit is contained in:
flash 2022-09-22 23:01:32 +00:00
parent 97607adf85
commit bc2f6d4b4f

View file

@ -21,20 +21,18 @@ ajaxChat.customInitialize = function() {
} }
ajaxChat.loadHTML5Sounds=function(){ ajaxChat.loadHTML5Sounds=function(){
aO = document.createElement('audio');
aO.id = 'audioObject';
document.body.appendChild(aO);
this.audioObject = document.getElementById('audioObject');
this.setAudioVolume(this.settings['audioVolume']); this.setAudioVolume(this.settings['audioVolume']);
this.sounds = {}; this.sounds = {};
for(var key in this.soundFiles){ for(var key in this.soundFiles) {
this.sounds[key] = this.dirs['sounds']+this.soundFiles[key]; this.sounds[key] = this.dirs['sounds'] + this.soundFiles[key];
} }
} }
ajaxChat.playHTML5Sound=function(soundID,soundFile){ ajaxChat.playHTML5Sound=function(soundID,soundFile){
this.audioObject.src = soundFile; var snd = document.createElement('audio');
this.audioObject.play(); snd.src = soundFile;
snd.volume = this.html5AudioVolume;
snd.play();
} }
ajaxChat.setHTML5SoundVolume=function(volume){ ajaxChat.setHTML5SoundVolume=function(volume){
this.audioObject.volume = volume; this.html5AudioVolume = volume;
} }