Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix media-video audioSrc set up in media-loader #4576

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/media-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ AFRAME.registerComponent("media-loader", {
}

let canonicalUrl = src;
let canonicalAudioUrl = src;
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;
Expand Down
4 changes: 3 additions & 1 deletion src/components/media-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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
Expand Down