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

BitECS media loading fixes #6119

Merged
merged 1 commit into from
Jul 12, 2023
Merged
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
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 }) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Just to confirm, this change is for linting, isn't it? Personally I prefer to separate updates for linting/formatting from bug fix/feature addition PRs for easier review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's only linting. As it was a really small linter update I thought it was fine to leave it here. I'll keep that in mind for the future.

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
Loading