From 08a3b1dad0a226c406bbebcc66ba78fe4ca738ff Mon Sep 17 00:00:00 2001 From: netpro2k <netpro2k@gmail.com> Date: Thu, 19 Jul 2018 14:47:38 -0700 Subject: [PATCH] Fix audio spatialization for audio files --- src/components/image-plus.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/image-plus.js b/src/components/image-plus.js index eba04b0fb..77356efc5 100644 --- a/src/components/image-plus.js +++ b/src/components/image-plus.js @@ -211,7 +211,7 @@ AFRAME.registerComponent("image-plus", { texture = await this.loadGIF(url); } else if (contentType.startsWith("image/")) { texture = await this.loadImage(url); - } else if (contentType.startsWith("video") || contentType.startsWith("audio/")) { + } else if (contentType.startsWith("video/") || contentType.startsWith("audio/")) { texture = await this.loadVideo(url); } else { throw new Error(`Unknown content type: ${contentType}`); @@ -220,7 +220,7 @@ AFRAME.registerComponent("image-plus", { textureCache.set(url, { count: 1, texture }); } - if (contentType.startsWith("video")) { + if (contentType.startsWith("video/") || contentType.startsWith("audio/")) { const sound = new THREE.PositionalAudio(this.el.sceneEl.audioListener); sound.setMediaElementSource(texture.image); this.el.setObject3D("sound", sound); -- GitLab