From bc2f6d4b4fd4991c53b89cf6ed379bb5e158098c Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 22 Sep 2022 23:01:32 +0000 Subject: [PATCH] Restored sound stacking in HTML5 audio backend for AJAX Chat. --- public/js/custom.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/js/custom.js b/public/js/custom.js index ad661bf..3a9fe76 100644 --- a/public/js/custom.js +++ b/public/js/custom.js @@ -21,20 +21,18 @@ ajaxChat.customInitialize = 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.sounds = {}; - for(var key in this.soundFiles){ - this.sounds[key] = this.dirs['sounds']+this.soundFiles[key]; + for(var key in this.soundFiles) { + this.sounds[key] = this.dirs['sounds'] + this.soundFiles[key]; } } ajaxChat.playHTML5Sound=function(soundID,soundFile){ - this.audioObject.src = soundFile; - this.audioObject.play(); + var snd = document.createElement('audio'); + snd.src = soundFile; + snd.volume = this.html5AudioVolume; + snd.play(); } ajaxChat.setHTML5SoundVolume=function(volume){ - this.audioObject.volume = volume; + this.html5AudioVolume = volume; }