Skip to content

Commit

Permalink
Merge pull request #6413 from mozilla/bitecs-aframe-media-fix
Browse files Browse the repository at this point in the history
Fix aframe media loading
  • Loading branch information
keianhzo authored Dec 11, 2023
2 parents 472c236 + 552ed78 commit 31b1f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/components/media-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { cloneObject3D, setMatrixWorld } from "../utils/three-utils";
import { waitForDOMContentLoaded } from "../utils/async-utils";

import { SHAPE } from "three-ammo/constants";
import { addComponent, entityExists, removeComponent } from "bitecs";
import { MediaContentBounds, MediaLoading } from "../bit-components";
import { addComponent } from "bitecs";
import { MediaContentBounds } from "../bit-components";

let loadingObject;

Expand Down Expand Up @@ -288,9 +288,6 @@ AFRAME.registerComponent("media-loader", {
MediaContentBounds.bounds[el.eid].set(contentBounds.toArray());

el.emit("media-loaded");
if (el.eid && entityExists(APP.world, el.eid)) {
removeComponent(APP.world, MediaLoading, el.eid);
}
};

if (this.data.animate) {
Expand Down Expand Up @@ -349,7 +346,6 @@ AFRAME.registerComponent("media-loader", {
try {
if ((forceLocalRefresh || srcChanged) && !this.showLoaderTimeout) {
this.showLoaderTimeout = setTimeout(this.showLoader, 100);
addComponent(APP.world, MediaLoading, this.el.eid);
}

//check if url is an anchor hash e.g. #Spawn_Point_1
Expand Down
3 changes: 1 addition & 2 deletions src/systems/bit-media-frames.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
MediaFrame,
MediaImage,
MediaLoaded,
MediaLoading,
MediaPDF,
MediaVideo,
Networked,
Expand Down Expand Up @@ -102,7 +101,7 @@ function getCapturableEntity(world, physicsSystem, frame) {
const eid = bodyData.object3D.eid;
if (
MediaFrame.mediaType[frame] & mediaTypeMaskFor(world, eid) &&
!hasComponent(world, MediaLoading, eid) &&
hasComponent(world, MediaContentBounds, eid) &&
!inOtherFrame(world, frame, eid) &&
!isAncestor(bodyData.object3D, frameObj)
) {
Expand Down

0 comments on commit 31b1f50

Please sign in to comment.