|
@@ -189,6 +189,13 @@ function connectWebSocket() {
|
|
|
try {
|
|
try {
|
|
|
const data = JSON.parse(event.data);
|
|
const data = JSON.parse(event.data);
|
|
|
if (data.type === 'status_update') {
|
|
if (data.type === 'status_update') {
|
|
|
|
|
+ // Always update global playback status (not throttled)
|
|
|
|
|
+ // This ensures play button always has current state
|
|
|
|
|
+ window.currentPlaybackStatus = {
|
|
|
|
|
+ is_running: data.data.is_running || false,
|
|
|
|
|
+ current_file: data.data.current_file || null
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// Throttle UI updates for better Pi performance
|
|
// Throttle UI updates for better Pi performance
|
|
|
const now = Date.now();
|
|
const now = Date.now();
|
|
|
if (now - lastUIUpdate < UI_UPDATE_INTERVAL) {
|
|
if (now - lastUIUpdate < UI_UPDATE_INTERVAL) {
|
|
@@ -196,12 +203,6 @@ function connectWebSocket() {
|
|
|
}
|
|
}
|
|
|
lastUIUpdate = now;
|
|
lastUIUpdate = now;
|
|
|
|
|
|
|
|
- // Update global playback status
|
|
|
|
|
- window.currentPlaybackStatus = {
|
|
|
|
|
- is_running: data.data.is_running || false,
|
|
|
|
|
- current_file: data.data.current_file || null
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
// Update modal status with the full data
|
|
// Update modal status with the full data
|
|
|
syncModalControls(data.data);
|
|
syncModalControls(data.data);
|
|
|
|
|
|