From b8b5c8b88fc854063c97716b683276a208adf33f Mon Sep 17 00:00:00 2001 From: Takahiro Date: Wed, 25 Aug 2021 13:55:36 -0700 Subject: [PATCH 1/2] Set media-video audioSrc attribute only when necessary --- src/components/media-loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/media-loader.js b/src/components/media-loader.js index 9fa57c3f47..a95f325d48 100644 --- a/src/components/media-loader.js +++ b/src/components/media-loader.js @@ -365,7 +365,7 @@ AFRAME.registerComponent("media-loader", { } let canonicalUrl = src; - let canonicalAudioUrl = src; + let canonicalAudioUrl = null; let accessibleUrl = src; let contentType = this.data.contentType; let thumbnail; From 5fc3b088ec1fed4094428a01be6d3db3ffc3c43b Mon Sep 17 00:00:00 2001 From: Takahiro Date: Wed, 25 Aug 2021 14:52:53 -0700 Subject: [PATCH 2/2] Add comments about audioSrc --- src/components/media-loader.js | 2 +- src/components/media-views.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/media-loader.js b/src/components/media-loader.js index a95f325d48..eed35cb8a6 100644 --- a/src/components/media-loader.js +++ b/src/components/media-loader.js @@ -365,7 +365,7 @@ AFRAME.registerComponent("media-loader", { } let canonicalUrl = src; - let canonicalAudioUrl = null; + let canonicalAudioUrl = null; // set non-null only if audio track is separated from video track (eg. 360 video) let accessibleUrl = src; let contentType = this.data.contentType; let thumbnail; diff --git a/src/components/media-views.js b/src/components/media-views.js index 79787d6eeb..6b7d4fdb49 100644 --- a/src/components/media-views.js +++ b/src/components/media-views.js @@ -259,7 +259,7 @@ const MAX_MULTIPLIER = 2; AFRAME.registerComponent("media-video", { schema: { src: { type: "string" }, - audioSrc: { type: "string" }, + audioSrc: { type: "string" }, // set only if audio track is separated from video track (eg. 360 video) contentType: { type: "string" }, loop: { type: "boolean", default: true }, hidePlaybackControls: { type: "boolean", default: false }, @@ -848,7 +848,9 @@ AFRAME.registerComponent("media-video", { videoEl.src = url; videoEl.onerror = failLoad; + // audioSrc is non-empty only if audio track is separated from video track (eg. 360 video) if (this.data.audioSrc) { + // Mute video track just in case videoEl.muted = true; // If there's an audio src, create an audio element to play it that we keep in sync