-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (19 loc) · 756 Bytes
/
script.js
File metadata and controls
23 lines (19 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { initPlayer } from './player.js';
import { initVisualizer } from './visualizer.js';
import { stateManager } from './state.js';
document.addEventListener('DOMContentLoaded', () => {
// Apply custom background if saved
const savedBg = localStorage.getItem('customBackground');
if (savedBg) {
document.body.style.backgroundImage = `url('${savedBg}')`;
}
if (document.getElementById('station-select')) {
// Initialize the core player logic
initPlayer();
// Once the player has created the audio context and source, initialize the visualizer
const state = stateManager.getState();
if (state.audioContext && state.source) {
initVisualizer();
}
}
});