aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorCaleb Mabry <36182383+caleb-mabry@users.noreply.github.com>2022-03-23 15:32:20 -0400
committerGitHub <noreply@github.com>2022-03-23 15:32:20 -0400
commita726bdd00060876be91b6b3f134ecc6867bbeed6 (patch)
tree228ef1f017ce0320f3d210a557d2803a03ec73e1 /webAO/client.js
parent2e734ec14fc760f80e2a9dc81cdf9269220bb791 (diff)
parent46d63b5ba4eeb30ac1f5add49b03b1aed8ae0328 (diff)
Merge pull request #119 from caleb-mabry/moving-audio-channels
Moving Audio Channels to HTML Elements
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/webAO/client.js b/webAO/client.js
index bf274db..e9eb13a 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1689,12 +1689,8 @@ class Viewport {
this.testimonyAudio = document.getElementById('client_testimonyaudio');
this.testimonyAudio.src = `${AO_HOST}sounds/general/sfx-guilty.opus`;
- this.music = new Array(
- new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
- new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
- new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
- new Audio(`${AO_HOST}sounds/music/trial (aa).opus`),
- );
+ const audioChannels = document.getElementsByClassName('audioChannel')
+ this.music = [...audioChannels];
this.music.forEach((channel) => channel.volume = 0.5);
this.music.forEach((channel) => channel.onerror = opusCheck(channel));
@@ -2612,6 +2608,10 @@ window.imgError = imgError;
* @param {HTMLImageElement} image the element containing the missing sound
*/
export function opusCheck(channel) {
+ const audio = channel.src
+ if (audio === '') {
+ return
+ }
console.info(`failed to load sound ${channel.src}`);
let oldsrc = '';
oldsrc = channel.src;