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

Fix video controls visibility #6455

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions src/bit-systems/media-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/bit-systems/video-menu-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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)) {
Expand Down
Loading