From a53a4e4a351d093c0e7404686ef91f9457640d1b Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Thu, 25 Jan 2024 12:14:23 +0100 Subject: [PATCH] Fix video controls visibility --- src/bit-systems/media-loading.ts | 10 ++++++++-- src/bit-systems/video-menu-system.ts | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bit-systems/media-loading.ts b/src/bit-systems/media-loading.ts index 5e770b486f..af9c1f1ddb 100644 --- a/src/bit-systems/media-loading.ts +++ b/src/bit-systems/media-loading.ts @@ -28,7 +28,8 @@ import { Networked, ObjectMenuTarget, Rigidbody, - MediaLoaderOffset + MediaLoaderOffset, + MediaVideo } from "../bit-components"; import { inflatePhysicsShape, Shape } from "../inflators/physics-shape"; import { ErrorObject } from "../prefabs/error-object"; @@ -53,6 +54,7 @@ import { findAncestorsWithComponent, findChildWithComponent } from "../utils/bit import { setMatrixWorld } from "../utils/three-utils"; import { computeObjectAABB, getScaleCoefficient } from "../utils/auto-box-collider"; import { updateHoverableVisuals } from "./hoverable-visuals-system"; +import { VIDEO_FLAGS } from "../inflators/video"; export function* waitForMediaLoaded(world: HubsWorld, eid: EntityID) { while (hasComponent(world, MediaLoader, eid)) { @@ -380,7 +382,11 @@ export function mediaLoadingSystem(world: HubsWorld) { const mediaEid = MediaLoader.mediaRef[mediaLoaderEid]; const mediaObj = world.eid2obj.get(mediaEid)!; - mediaObj.visible = true; + if (MediaInfo.mediaType[mediaEid] === MediaType.AUDIO) { + mediaObj.visible = Boolean(MediaVideo.flags[mediaEid] & VIDEO_FLAGS.CONTROLS); + } else { + mediaObj.visible = true; + } resizeAndRecenter(world, mediaLoaderEid, box); diff --git a/src/bit-systems/video-menu-system.ts b/src/bit-systems/video-menu-system.ts index 9939d73989..0e19a3c259 100644 --- a/src/bit-systems/video-menu-system.ts +++ b/src/bit-systems/video-menu-system.ts @@ -33,6 +33,7 @@ import { ObjectMenuTransformFlags } from "../inflators/object-menu-transform"; import { MediaType } from "../utils/media-utils"; import { VolumeControlsMaterial } from "../prefabs/video-menu"; import { updateAudioSettings } from "../update-audio-settings"; +import { VIDEO_FLAGS } from "../inflators/video"; const videoMenuQuery = defineQuery([VideoMenu]); const hoveredQuery = defineQuery([HoveredRemoteRight]); @@ -100,7 +101,7 @@ function findVideoMenuTarget(world: HubsWorld, menu: EntityID, sceneIsFrozen: bo function flushToObject3Ds(world: HubsWorld, menu: EntityID, frozen: boolean) { const target = VideoMenu.videoRef[menu]; - let visible = !!(target && !frozen); + let visible = !!(target && !frozen) && Boolean(MediaVideo.flags[target] & VIDEO_FLAGS.CONTROLS); const loader = findAncestorWithComponent(world, MediaLoader, target); if (loader && hasComponent(world, Deleting, loader)) {