Skip to content

Commit

Permalink
Media loading fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jul 5, 2023
1 parent 31373a2 commit 4c4e61a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/bit-systems/media-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ const loaderForMediaType = {
{ accessibleUrl, contentType }: { accessibleUrl: string; contentType: string }
) => loadModel(world, accessibleUrl, contentType, true),
[MediaType.PDF]: (world: HubsWorld, { accessibleUrl }: { accessibleUrl: string }) => loadPDF(world, accessibleUrl),
[MediaType.AUDIO]: (world: HubsWorld, { accessibleUrl }: { accessibleUrl: string }) => loadAudio(world, accessibleUrl),
[MediaType.HTML]: (world: HubsWorld, { canonicalUrl, thumbnail }: { canonicalUrl: string, thumbnail: string }) =>
[MediaType.AUDIO]: (world: HubsWorld, { accessibleUrl }: { accessibleUrl: string }) =>
loadAudio(world, accessibleUrl),
[MediaType.HTML]: (world: HubsWorld, { canonicalUrl, thumbnail }: { canonicalUrl: string; thumbnail: string }) =>
loadHtml(world, canonicalUrl, thumbnail)
};

Expand All @@ -100,6 +101,10 @@ function resizeAndRecenter(world: HubsWorld, media: EntityID, eid: EntityID) {
const box = new Box3();
box.setFromObject(mediaObj);

// The AABB can be empty here for interactables that fetch media (ie. gltf with an empty that has a video component).
// If we don't return the interactable would be wrongly positioned at the (0,0,0).
if (box.isEmpty()) return;

let scalar = 1;
if (resize) {
const size = new Vector3();
Expand Down

0 comments on commit 4c4e61a

Please sign in to comment.