Fix: stuck audio in Chrome needs to be resumed on click due to security
This commit is contained in:
parent
b2166fe26a
commit
ee6ae3a688
@ -110,9 +110,7 @@ export class ConfigUI extends SceneFeature {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Blackout Toggle
|
// Blackout Toggle
|
||||||
createToggle('BLACKOUT', 'blackout', (enabled) => {
|
createToggle('BLACKOUT', 'blackout');
|
||||||
state.blackoutMode = enabled;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Torches Toggle
|
// Torches Toggle
|
||||||
createToggle('Stage Torches', 'torchesEnabled');
|
createToggle('Stage Torches', 'torchesEnabled');
|
||||||
@ -486,7 +484,7 @@ export class ConfigUI extends SceneFeature {
|
|||||||
lightBarsEnabled: true,
|
lightBarsEnabled: true,
|
||||||
laserColorMode: 'RUNNING',
|
laserColorMode: 'RUNNING',
|
||||||
guestCount: 150,
|
guestCount: 150,
|
||||||
blackout: false,
|
blackout: true,
|
||||||
djHat: 'None',
|
djHat: 'None',
|
||||||
debugPanelEnabled: false
|
debugPanelEnabled: false
|
||||||
};
|
};
|
||||||
|
|||||||
@ -16,6 +16,11 @@ export class MusicPlayer extends SceneFeature {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
state.music.player = document.getElementById('audioPlayer');
|
state.music.player = document.getElementById('audioPlayer');
|
||||||
|
if (!state.music.player) {
|
||||||
|
state.music.player = document.createElement('audio');
|
||||||
|
state.music.player.id = 'audioPlayer';
|
||||||
|
document.body.appendChild(state.music.player);
|
||||||
|
}
|
||||||
state.music.loudness = 0;
|
state.music.loudness = 0;
|
||||||
state.music.loudnessAverage = 0;
|
state.music.loudnessAverage = 0;
|
||||||
const loadButton = document.getElementById('loadMusicButton');
|
const loadButton = document.getElementById('loadMusicButton');
|
||||||
@ -75,6 +80,10 @@ export class MusicPlayer extends SceneFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startSequence() {
|
startSequence() {
|
||||||
|
if (this.audioContext && this.audioContext.state === 'suspended') {
|
||||||
|
this.audioContext.resume();
|
||||||
|
}
|
||||||
|
|
||||||
const uiContainer = document.getElementById('ui-container');
|
const uiContainer = document.getElementById('ui-container');
|
||||||
const configUILeft = document.getElementById('config-ui-left');
|
const configUILeft = document.getElementById('config-ui-left');
|
||||||
const configUIRight = document.getElementById('config-ui-right');
|
const configUIRight = document.getElementById('config-ui-right');
|
||||||
|
|||||||
@ -468,9 +468,15 @@ export function updateScreenEffect() {
|
|||||||
const material = s.mesh.material;
|
const material = s.mesh.material;
|
||||||
if (!material || !material.uniforms) return;
|
if (!material || !material.uniforms) return;
|
||||||
|
|
||||||
material.uniforms.u_time.value = state.clock.getElapsedTime();
|
if (material.uniforms.u_time) {
|
||||||
material.uniforms.u_effect_type.value = state.screenEffect.type;
|
material.uniforms.u_time.value = state.clock.getElapsedTime();
|
||||||
material.uniforms.u_effect_strength.value = strength;
|
}
|
||||||
|
if (material.uniforms.u_effect_type) {
|
||||||
|
material.uniforms.u_effect_type.value = state.screenEffect.type;
|
||||||
|
}
|
||||||
|
if (material.uniforms.u_effect_strength) {
|
||||||
|
material.uniforms.u_effect_strength.value = strength;
|
||||||
|
}
|
||||||
|
|
||||||
if (material.uniforms.u_opacity) {
|
if (material.uniforms.u_opacity) {
|
||||||
const targetOpacity = state.blackoutMode ? 0.1 : (state.screenOpacity !== undefined ? state.screenOpacity : 0.7);
|
const targetOpacity = state.blackoutMode ? 0.1 : (state.screenOpacity !== undefined ? state.screenOpacity : 0.7);
|
||||||
@ -478,8 +484,8 @@ export function updateScreenEffect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (progress >= 1.0) {
|
if (progress >= 1.0) {
|
||||||
material.uniforms.u_effect_type.value = 0.0;
|
if (material.uniforms.u_effect_type) material.uniforms.u_effect_type.value = 0.0;
|
||||||
material.uniforms.u_effect_strength.value = 0.0;
|
if (material.uniforms.u_effect_strength) material.uniforms.u_effect_strength.value = 0.0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user