diff --git a/party-stage/src/core/video-player.js b/party-stage/src/core/video-player.js index a407dbe..35a0694 100644 --- a/party-stage/src/core/video-player.js +++ b/party-stage/src/core/video-player.js @@ -1,6 +1,18 @@ import * as THREE from 'three'; import { state } from '../state.js'; import { turnTvScreenOff, turnTvScreenOn } from '../scene/projection-screen.js'; +import sceneFeatureManager from '../scene/SceneFeatureManager.js'; + +// Register a feature to handle party start +sceneFeatureManager.register({ + init: () => {}, + update: () => {}, + onPartyStart: () => { + if (state.videoUrls && state.videoUrls.length > 0) { + startVideoPlayback(); + } + } +}); // --- Play video by index --- export function playVideoByIndex(index) { @@ -70,6 +82,14 @@ export function playNextVideo() { playVideoByIndex(nextIndex); } +export function startVideoPlayback() { + if (state.videoUrls && state.videoUrls.length > 0) { + console.info(`Starting playback of ${state.videoUrls.length} tapes.`); + if (state.loadTapeButton) state.loadTapeButton.classList.add("hidden"); + playVideoByIndex(0); + } +} + export function playPreviousVideo() { let prevIndex = state.currentVideoIndex - 1; if (prevIndex < 0) { @@ -160,11 +180,13 @@ export function loadVideoFile(event) { return; } - // 3. Start playback of the first video - console.info(`Loaded ${state.videoUrls.length} tapes. Starting playback...`); - state.loadTapeButton.classList.add("hidden"); - - const startDelay = 5; - console.info(`Video will start in ${startDelay} seconds.`); - setTimeout(() => { playVideoByIndex(0); }, startDelay * 1000); + // 3. Start playback logic + console.info(`Loaded ${state.videoUrls.length} tapes.`); + + if (state.partyStarted) { + startVideoPlayback(); + } else { + console.info("Tapes loaded. Waiting for party start..."); + if (state.loadTapeButton) state.loadTapeButton.innerText = "Tapes Ready"; + } } \ No newline at end of file diff --git a/party-stage/src/scene/projection-screen.js b/party-stage/src/scene/projection-screen.js index fb6b2a0..af5ba1f 100644 --- a/party-stage/src/scene/projection-screen.js +++ b/party-stage/src/scene/projection-screen.js @@ -12,7 +12,7 @@ void main() { } `; -const ledCountX = 256; +const ledCountX = 128; const ledCountY = ledCountX * (9 / 16); const screenFragmentShader = `