From 009b477b11c9123b362a0de0faa50bf21afd557d Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Fri, 8 Dec 2023 17:04:27 +0100 Subject: [PATCH 1/2] Fix aframe media loading --- src/components/media-loader.js | 8 ++------ src/systems/bit-media-frames.js | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/media-loader.js b/src/components/media-loader.js index e76eb88354..7ecc2d8395 100644 --- a/src/components/media-loader.js +++ b/src/components/media-loader.js @@ -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, MediaLoaded } from "../bit-components"; let loadingObject; @@ -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) { @@ -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 diff --git a/src/systems/bit-media-frames.js b/src/systems/bit-media-frames.js index 0181708cac..f56ed3ad79 100644 --- a/src/systems/bit-media-frames.js +++ b/src/systems/bit-media-frames.js @@ -20,7 +20,6 @@ import { MediaFrame, MediaImage, MediaLoaded, - MediaLoading, MediaPDF, MediaVideo, Networked, @@ -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) ) { From 552ed7873ab160c36792f1ec0821269ad9677e5e Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Fri, 8 Dec 2023 17:12:29 +0100 Subject: [PATCH 2/2] Remove unused import --- 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 7ecc2d8395..9c89bbddcf 100644 --- a/src/components/media-loader.js +++ b/src/components/media-loader.js @@ -29,7 +29,7 @@ import { waitForDOMContentLoaded } from "../utils/async-utils"; import { SHAPE } from "three-ammo/constants"; import { addComponent } from "bitecs"; -import { MediaContentBounds, MediaLoaded } from "../bit-components"; +import { MediaContentBounds } from "../bit-components"; let loadingObject;