@@ -158,7 +158,7 @@
diff --git a/templates/player/listening_scripts.html b/templates/player/listening_scripts.html
index 467a131..5f2f685 100644
--- a/templates/player/listening_scripts.html
+++ b/templates/player/listening_scripts.html
@@ -55,6 +55,7 @@ document.addEventListener('alpine:init', () => {
clock(ms) { return times.format(new Date(ms)); },
coverFailed(image) {
image.setAttribute('data-unavailable', '');
+ if (Alpine.store('offline')?.localArtworkOnly) return;
const path = image.getAttribute('src') || '';
if (/^\/api\/player\/cover\/\d+\/small$/.test(path)) {
image.src = path.slice(0, -'/small'.length);
diff --git a/templates/player/offline_scripts.html b/templates/player/offline_scripts.html
index 2048f2f..cd6d80c 100644
--- a/templates/player/offline_scripts.html
+++ b/templates/player/offline_scripts.html
@@ -20,6 +20,58 @@ document.addEventListener('alpine:init', () => {
let wakeQueue = false, blocked = false, retryDelay = 5000;
let revision = 0, listVersion = 0, lastSuccess = Date.now(), channel;
function catalog() { return repo || (repo = new globalThis.OfflineCatalog(account)); }
+ // Share each disk-backed cover between visible tiles, the player and the OS media controls.
+ // The final consumer releases the URL when a row disappears or changes its artwork.
+ const covers = new Map();
+ function acquireCover(key, display) {
+ let entry = covers.get(key);
+ if (!entry) {
+ entry = {users:0, url:null};
+ covers.set(key, entry);
+ entry.ready = catalog().read('assets', key).then(blob => {
+ if (blob?.size && covers.get(key) === entry) entry.url = URL.createObjectURL(blob);
+ }).catch(() => {});
+ }
+ let live = true;
+ ++entry.users;
+ entry.ready.then(() => { if (live) display(entry.url); });
+ return () => {
+ live = false;
+ if (--entry.users) return;
+ covers.delete(key);
+ if (entry.url) URL.revokeObjectURL(entry.url);
+ };
+ }
+ const lazyCovers = new WeakMap();
+ const coverObserver = 'IntersectionObserver' in window && new IntersectionObserver(entries => {
+ for (const entry of entries) lazyCovers.get(entry.target)?.(entry.isIntersecting);
+ }, {rootMargin:'450px'});
+ const missingCover = 'data:image/svg+xml,' + encodeURIComponent('
');
+ Alpine.directive('artwork', (image, {expression}, {evaluateLater, effect, cleanup}) => {
+ const read = evaluateLater(expression);
+ let dispose;
+ function clear() { dispose?.(); dispose = null; }
+ effect(() => read(url => {
+ clear();
+ const offline = Alpine.store('offline');
+ const show = src => {
+ if (src) image.setAttribute('src', src);
+ else image.removeAttribute('src');
+ };
+ if (!offline.localArtworkOnly || !url || /^(?:blob:|data:)/i.test(url)) { show(url); return; }
+ show(null);
+ const open = () => offline.bindArtwork(url, src => show(src || missingCover));
+ if (image.loading !== 'lazy' || !coverObserver) { dispose = open(); return; }
+ let release;
+ lazyCovers.set(image, visible => {
+ if (visible && !release) release = open();
+ if (!visible && release) { show(null); release(); release = null; }
+ });
+ coverObserver.observe(image);
+ dispose = () => { coverObserver.unobserve(image); lazyCovers.delete(image); release?.(); };
+ }));
+ cleanup(clear);
+ });
function eligible(track) {
return globalThis.OfflineCatalog?.canSave(track) === true;
}
@@ -299,6 +351,17 @@ document.addEventListener('alpine:init', () => {
}).catch(() => { this.error = label('storage'); });
},
localResponse(request) { return catalog().respond(request); },
+ get localArtworkOnly() { return this.active || (this.enabled && navigator.onLine === false); },
+ bindArtwork(url, display) {
+ if (!this.localArtworkOnly || !url || /^(?:blob:|data:)/i.test(url)) {
+ display(url);
+ return;
+ }
+ const key = OfflineCatalog.artworkKey(url);
+ if (key) return acquireCover(key, display);
+ display(null);
+ },
+ openAudio(track) { return catalog().openAudio(track); },
async played(track) {
if (!this.enabled || !eligible(track)) return;
try {
diff --git a/templates/player/playlist_header.html b/templates/player/playlist_header.html
index cd2ef8d..fcb048a 100644
--- a/templates/player/playlist_header.html
+++ b/templates/player/playlist_header.html
@@ -85,7 +85,7 @@
:aria-pressed="header.selected.includes(option.cover_id)"
:disabled="header.selected.length >= 4 && !header.selected.includes(option.cover_id)"
@click="header.toggleRelease(option.cover_id)">
-
![]()
+
diff --git a/templates/player/playlist_tiles.html b/templates/player/playlist_tiles.html
index 775b0c0..7711138 100644
--- a/templates/player/playlist_tiles.html
+++ b/templates/player/playlist_tiles.html
@@ -1,7 +1,7 @@
-
diff --git a/templates/player/podcast_artwork.html b/templates/player/podcast_artwork.html
index a0e0c75..b57e664 100644
--- a/templates/player/podcast_artwork.html
+++ b/templates/player/podcast_artwork.html
@@ -1,6 +1,6 @@
{
const url = new URL(input instanceof Request ? input.url : input, window.location.href);
const offline = window.Alpine?.store('offline');
- if (offline?.active && !(offline.automatic && url.origin === location.origin && url.pathname === '/offline-probe')) {
+ // The browser can disable networking before it delivers the offline event.
+ const disconnected = offline?.enabled && offline.supported && navigator.onLine === false;
+ const recoveryProbe = offline?.automatic && url.origin === location.origin && url.pathname === '/offline-probe';
+ if (disconnected || (offline?.active && !recoveryProbe)) {
if (url.origin === location.origin && url.pathname.startsWith('/api/player/')) {
const request = new Request(input instanceof Request ? input : url.href, init);
const local = await offline.localResponse(request);
@@ -744,9 +739,24 @@ document.addEventListener('alpine:init', () => {
// Player store
// -----------------------------------------------------------------------
let playbackConnection = new AbortController();
+ let releaseSessionArtwork, sessionMetadataKey;
+ let pendingMedia = null, audioObjectUrl = null, audibleTrackId = null;
+
+ // Firefox updates onLine before delivering the offline event that switches the catalog.
+ function deviceSyncUnavailable() { return playerOffline() || navigator.onLine === false; }
+
+ function detachAudio() {
+ if (audio.hasAttribute('src')) {
+ audio.removeAttribute('src');
+ audio.load();
+ }
+ if (audioObjectUrl) URL.revokeObjectURL(audioObjectUrl);
+ audioObjectUrl = null;
+ }
window.addEventListener('furumusic:offline-mode', () => {
playbackConnection.abort();
playbackConnection = new AbortController();
+ Alpine.store('player')._updateMediaSession();
});
Alpine.store('player', {
@@ -787,6 +797,8 @@ document.addEventListener('alpine:init', () => {
});
audio.addEventListener('timeupdate', () => {
+ // Loading or losing an HTTP source can report a zero position before cache recovery.
+ if (pendingMedia || audio.error || !audio.readyState) return;
this.currentTime = audio.currentTime;
this.duration = audio.duration || 0;
this.progress = this.duration > 0 ? (this.currentTime / this.duration) * 100 : 0;
@@ -796,7 +808,8 @@ document.addEventListener('alpine:init', () => {
});
audio.addEventListener('ended', () => {
- if (playerOffline() && this._offlinePlaybackHeld) return;
+ if (pendingMedia || !audio.ended || (playerOffline() && this._offlinePlaybackHeld)) return;
+ audibleTrackId = null;
if (this.currentTrack?.podcast) {
this.isPlaying = false;
this.currentTrack.podcast_completed = true;
@@ -813,20 +826,22 @@ document.addEventListener('alpine:init', () => {
});
audio.addEventListener('playing', () => {
- if (audio.paused || (playerOffline() && this._offlinePlaybackHeld)) return;
+ if (pendingMedia || audio.paused || (playerOffline() && this._offlinePlaybackHeld)) return;
+ audibleTrackId = this._localSourceTrackId;
if (!this._cachePlayCounted && Alpine.store('offline')?.enabled) {
this._cachePlayCounted = true;
Alpine.store('offline').played(this.currentTrack);
}
});
audio.addEventListener('play', () => {
- if (audio.paused || (playerOffline() && this._offlinePlaybackHeld)) return;
+ if (pendingMedia || audio.paused || (playerOffline() && this._offlinePlaybackHeld)) return;
this.isPlaying = true;
if (!this._playbackStartedAt) this._playbackStartedAt = Math.floor(Date.now() / 1000);
this._lastAudioTime = audio.currentTime || 0;
this._sendNowPlaying();
});
audio.addEventListener('pause', () => {
+ if (pendingMedia || !audio.paused) return;
if (this.currentTrack?.podcast) Alpine.store('podcasts')?.checkpoint(this, !!this.currentTrack.podcast_completed);
this._trackListenedDelta();
this.isPlaying = false;
@@ -836,6 +851,16 @@ document.addEventListener('alpine:init', () => {
audio.addEventListener('loadedmetadata', () => {
this.duration = audio.duration || 0;
});
+ audio.addEventListener('error', () => {
+ const offline = Alpine.store('offline'), track = this.currentTrack;
+ if (!audio.error || pendingMedia || audioObjectUrl || !offline?.enabled || offline.active ||
+ !track || track.id !== this._localSourceTrackId) return;
+ // A native media load can fail before fetch or navigator notices the outage.
+ offline.networkResult(false);
+ if (!offline.active && this._isLocalPlaybackDevice() && audibleTrackId === track.id && offline.isSaved(track)) {
+ this._loadSource(track, this.currentTime, false, true);
+ }
+ });
// Periodic state save
this._saveTimer = setInterval(() => {
@@ -851,11 +876,17 @@ document.addEventListener('alpine:init', () => {
}
// Save state on page unload
- window.addEventListener('pagehide', () => {
+ window.addEventListener('pagehide', (event) => {
if (this._isLocalPlaybackDevice()) {
this._saveStateSync();
this._recordHistory('stopped', true);
}
+ if (!event.persisted) {
+ releaseSessionArtwork?.();
+ releaseSessionArtwork = sessionMetadataKey = null;
+ pendingMedia = null;
+ if (audioObjectUrl) detachAudio();
+ }
});
window.addEventListener('pageshow', (event) => {
if (event.persisted && this._historyRecorded) {
@@ -946,19 +977,46 @@ document.addEventListener('alpine:init', () => {
this._localSourceTrackId = track.id;
this._historyRecorded = false;
this._resetPlaybackTracking();
- audio.src = playbackSource(track);
const seekSeconds = Number(options.position_seconds || 0);
this.currentTime = seekSeconds;
this.duration = Number(track.duration_seconds || 0);
this.progress = this.duration > 0 ? seekSeconds / this.duration * 100 : 0;
- this._seekOnLoad(seekSeconds);
- if (options.paused) {
+ this._updateMediaSession();
+ return this._loadSource(track, seekSeconds, !!options.paused);
+ },
+
+ async _loadSource(track, position, paused, recoverStream = false) {
+ const offline = Alpine.store('offline');
+ const localOnly = () => recoverStream || !!track.offline_remote || offline?.active || (offline?.enabled && navigator.onLine === false);
+ this._seekOnLoad(0);
+ pendingMedia = null;
+ audibleTrackId = null;
+ if (localOnly() || (offline?.enabled && offline.isSaved(track))) {
+ // Media requests can fail in browser offline mode before reaching the service worker.
+ // Keep the actual File in the media pipeline, with native seeking and streaming.
+ const request = pendingMedia = {position, paused, recoverStream};
+ detachAudio();
+ this.isPlaying = false;
+ const file = await offline.openAudio(track).catch(() => null);
+ if (pendingMedia !== request) return;
+ pendingMedia = null;
+ if (file) audioObjectUrl = URL.createObjectURL(file);
+ else if (localOnly()) {
+ this._localSourceTrackId = null;
+ return;
+ }
+ ({position, paused} = request);
+ } else if (audioObjectUrl) {
+ detachAudio();
+ }
+ audio.src = audioObjectUrl || track.stream_url;
+ this._seekOnLoad(position);
+ if (paused) {
audio.pause();
this.isPlaying = false;
} else {
audio.play().catch(() => {});
}
- this._updateMediaSession();
},
_seekOnLoad(seconds) {
@@ -974,6 +1032,9 @@ document.addEventListener('alpine:init', () => {
},
_pauseLocal() {
+ audibleTrackId = null;
+ if (pendingMedia) pendingMedia.paused = true;
+ if (playerOffline()) this._offlinePlaybackHeld = true;
audio.pause();
this.isPlaying = false;
},
@@ -982,7 +1043,9 @@ document.addEventListener('alpine:init', () => {
// Read the online owner before offline mode makes this tab the active device.
// Jam monitoring can play real local audio on a tab that only controls the owner.
const ownedPlayback = this._isLocalPlaybackDevice();
- this._offlinePlaybackHeld = !ownedPlayback || !this.isPlaying || audio.paused || audio.ended ||
+ const lostStream = (audio.error && audibleTrackId === this._localSourceTrackId) ||
+ (pendingMedia?.recoverStream && !pendingMedia.paused);
+ this._offlinePlaybackHeld = !ownedPlayback || ((!this.isPlaying || audio.paused) && !lostStream) || audio.ended ||
!this.currentTrack || this.currentTrack.id !== this._localSourceTrackId;
if (this._offlinePlaybackHeld) this._pauseLocal();
if (!ownedPlayback) this._cachePlayCounted = false;
@@ -991,28 +1054,38 @@ document.addEventListener('alpine:init', () => {
useOfflineCatalog(saved) {
const byId = new Map(saved.map(t => [Number(t.id), t]));
const byContent = new Map(saved.filter(t => t.content_id).map(t => [t.content_id, t]));
- const lookup = t => t && (byId.get(OfflineCatalog.trackId(t)) || byContent.get(t.content_id));
+ const lookup = track => {
+ if (!track) return null;
+ const local = byId.get(OfflineCatalog.trackId(track));
+ return local && (!track.content_id || !local.content_id || local.content_id === track.content_id)
+ ? local : byContent.get(track.content_id);
+ };
const queue = Alpine.store('queue');
queue.tracks = queue.tracks.map(lookup).filter(Boolean);
const previous = this.currentTrack;
const cached = lookup(previous);
if (cached) {
queue.syncCurrentIndexToTrack(cached);
- const playingHere = !this._offlinePlaybackHeld && !audio.paused && !audio.ended;
- if (!this._offlineSession || this._localSourceTrackId !== cached.id || this.isPlaying !== playingHere) {
+ if ((audioObjectUrl || pendingMedia) && this._localSourceTrackId === previous.id) {
+ // Already reading this recording locally. Keep its decoder, playhead and play count.
+ this.currentTrack = this._historyTrack = cached;
+ this._localSourceTrackId = cached.id;
+ if (audibleTrackId === previous.id) audibleTrackId = cached.id;
+ this._offlineSession = true;
+ } else {
const counted = this._cachePlayCounted;
- this._playLocal(cached, {paused:!playingHere, position_seconds:this.currentTime});
+ this._playLocal(cached, {paused:this._offlinePlaybackHeld, position_seconds:this.currentTime});
this._cachePlayCounted = counted;
}
} else if (previous) {
this._offlineSession = true;
this._seekOnLoad(0);
this._pauseLocal();
- audio.removeAttribute('src');
- audio.load();
+ pendingMedia = null;
+ detachAudio();
this.currentTrack = this._historyTrack = this._localSourceTrackId = null;
this.currentTime = this.progress = this.duration = 0;
- if ('mediaSession' in navigator) navigator.mediaSession.metadata = null;
+ this._updateMediaSession();
}
if (!cached) queue.currentIndex = -1;
Alpine.store('offline').saveState(this._buildStatePayload(true));
@@ -1038,22 +1111,29 @@ document.addEventListener('alpine:init', () => {
this._remoteStateBaseTime = this.currentTime;
this._remoteStateReceivedAt = Date.now();
if (this._shouldMirrorRemoteLocally()) {
- audio.play().catch(() => {});
+ this._resumeLocal();
}
this._sendRemote('resume');
return;
}
this._offlinePlaybackHeld = false;
- if (playerOffline() && this.currentTrack && (!this._offlineSession || this._localSourceTrackId !== this.currentTrack.id)) {
+ const offline = Alpine.store('offline');
+ const retrySaved = audio.error && !audioObjectUrl && offline?.enabled && offline.isSaved(this.currentTrack);
+ if (this.currentTrack && (retrySaved || (playerOffline() && (!this._offlineSession || this._localSourceTrackId !== this.currentTrack.id)))) {
this._playLocal(this.currentTrack, {position_seconds:this.currentTime});
return;
}
- audio.play().catch(() => {});
+ this._resumeLocal();
+ },
+
+ _resumeLocal() {
+ if (pendingMedia) pendingMedia.paused = false;
+ else audio.play().catch(() => {});
},
toggle() {
if (!this.currentTrack) return;
- if (this.isPlaying) { this.pause(); }
+ if (this.isPlaying || pendingMedia && !pendingMedia.paused) { this.pause(); }
else { this.resume(); }
},
@@ -1071,6 +1151,15 @@ document.addEventListener('alpine:init', () => {
this._sendRemote('seek', { time: nextTime });
return;
}
+ if (pendingMedia) {
+ pendingMedia.position = this.currentTime = nextTime;
+ return;
+ }
+ if (!audio.readyState) {
+ this.currentTime = nextTime;
+ this._seekOnLoad(nextTime);
+ return;
+ }
audio.currentTime = nextTime;
this._lastAudioTime = audio.currentTime || 0;
},
@@ -1078,7 +1167,7 @@ document.addEventListener('alpine:init', () => {
seekRelative(delta) {
if (!this.currentTrack) return;
const duration = this.duration || audio.duration || 0;
- const current = this._shouldSendRemote() ? this.currentTime : audio.currentTime;
+ const current = pendingMedia || !audio.readyState || this._shouldSendRemote() ? this.currentTime : audio.currentTime;
const max = duration > 0 ? duration : Number.MAX_SAFE_INTEGER;
this.seek(Math.max(0, Math.min(max, current + delta)));
},
@@ -1265,7 +1354,7 @@ document.addEventListener('alpine:init', () => {
},
_applyRemotePlaybackState(state) {
- if (!state) return;
+ if (!state || deviceSyncUnavailable()) return;
const queue = Alpine.store('queue');
const tracks = Array.isArray(state.tracks) ? state.tracks.filter(Boolean) : [];
if (queue && tracks.length > 0) {
@@ -1289,7 +1378,7 @@ document.addEventListener('alpine:init', () => {
},
_syncLocalPlaybackState(state) {
- if (!state) return;
+ if (!state || deviceSyncUnavailable()) return;
const queue = Alpine.store('queue');
const tracks = Array.isArray(state.tracks) ? state.tracks.filter(Boolean) : [];
if (queue && tracks.length > 0) {
@@ -1314,6 +1403,9 @@ document.addEventListener('alpine:init', () => {
position_seconds: desiredTime,
paused: !!state.paused,
});
+ } else if (pendingMedia) {
+ pendingMedia.position = desiredTime;
+ pendingMedia.paused = !!state.paused;
} else {
const drift = Math.abs((audio.currentTime || 0) - desiredTime);
const driftLimit = state.paused ? 0.08 : 0.75;
@@ -1351,7 +1443,7 @@ document.addEventListener('alpine:init', () => {
},
_executeRemoteCommand(command) {
- if (!command || !command.command) return;
+ if (!command?.command || deviceSyncUnavailable()) return;
const payload = command.payload || {};
const queue = Alpine.store('queue');
this._remoteExecuting = true;
@@ -1405,18 +1497,32 @@ document.addEventListener('alpine:init', () => {
},
_updateMediaSession() {
- if (!('mediaSession' in navigator) || !this.currentTrack) return;
+ if (!('mediaSession' in navigator)) return;
const t = this.currentTrack;
- navigator.mediaSession.metadata = new MediaMetadata({
- title: t.title,
- artist: t.artists.map(a => a.name).join(', '),
- artwork: t.cover_url ? [{ src: coverVariantUrl(t.cover_url, 'large'), sizes: '512x512', type: 'image/jpeg' }] : [],
- });
- navigator.mediaSession.setActionHandler('play', () => this.resume());
- navigator.mediaSession.setActionHandler('pause', () => this.pause());
- navigator.mediaSession.setActionHandler('previoustrack', () => this.prev());
- navigator.mediaSession.setActionHandler('nexttrack', () => this.next());
- navigator.mediaSession.setActionHandler('seekto', (d) => { if (d.seekTime != null) this.seek(d.seekTime); });
+ const artist = Array.isArray(t?.artists) ? t.artists.map(a => a?.name || a).join(', ') : '';
+ const cover = typeof t?.cover_url === 'string' ? coverVariantUrl(t.cover_url, 'large') : null;
+ const key = t && JSON.stringify([t.id, t.title, artist, cover, Alpine.store('offline').localArtworkOnly]);
+ if (key === sessionMetadataKey) return;
+ sessionMetadataKey = key;
+ releaseSessionArtwork?.();
+ releaseSessionArtwork = null;
+ // OS media controls are optional. An unsupported action or image must never interrupt audio.
+ try {
+ const metadata = t ? new MediaMetadata({title:t.title, artist}) : null;
+ navigator.mediaSession.metadata = metadata;
+ if (!metadata) return;
+ if (cover) releaseSessionArtwork = Alpine.store('offline').bindArtwork(cover, src => {
+ try {
+ // Firefox requires absolute URLs for MediaImage, including online covers.
+ metadata.artwork = src ? [{src:new URL(src, document.baseURI).href}] : [];
+ } catch { /* Keep the text if the platform rejects this artwork. */ }
+ });
+ navigator.mediaSession.setActionHandler('play', () => this.resume());
+ navigator.mediaSession.setActionHandler('pause', () => this.pause());
+ navigator.mediaSession.setActionHandler('previoustrack', () => this.prev());
+ navigator.mediaSession.setActionHandler('nexttrack', () => this.next());
+ navigator.mediaSession.setActionHandler('seekto', d => { if (d.seekTime != null) this.seek(d.seekTime); });
+ } catch { /* Playback does not depend on Media Session support. */ }
},
_buildStatePayload(forDeviceCache = false) {
@@ -1518,9 +1624,8 @@ document.addEventListener('alpine:init', () => {
this._localSourceTrackId = currentTrack.id;
this._historyRecorded = false;
this._resetPlaybackTracking();
- audio.src = playbackSource(currentTrack);
- // Seek to saved position once metadata is loaded
- this._seekOnLoad((state.position_ms || 0) / 1000);
+ this.currentTime = (state.position_ms || 0) / 1000;
+ this._loadSource(currentTrack, this.currentTime, true);
this._updateMediaSession();
}
}
@@ -1710,7 +1815,7 @@ document.addEventListener('alpine:init', () => {
},
async _requestState(path, payload) {
- if (playerOffline()) return null;
+ if (deviceSyncUnavailable()) return null;
const {signal} = playbackConnection;
const res = await fetch(path, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
@@ -1718,11 +1823,11 @@ document.addEventListener('alpine:init', () => {
});
if (!res.ok) return null;
const data = await res.json();
- return signal.aborted || playerOffline() ? null : data;
+ return signal.aborted || deviceSyncUnavailable() ? null : data;
},
async heartbeat() {
- if (playerOffline()) return;
+ if (deviceSyncUnavailable()) return;
try {
const data = await this._requestState('/api/player/devices/heartbeat', this.requestPayload());
if (data) this._apply(data);
@@ -1730,7 +1835,7 @@ document.addEventListener('alpine:init', () => {
},
async poll() {
- if (playerOffline()) return;
+ if (deviceSyncUnavailable()) return;
try {
const data = await this._requestState('/api/player/devices/poll', this.requestPayload());
if (!data) return;
@@ -1758,7 +1863,7 @@ document.addEventListener('alpine:init', () => {
},
_apply(data) {
- if (playerOffline()) return;
+ if (deviceSyncUnavailable()) return;
const previousJamId = this.currentJamId;
this.activeDeviceId = data.active_device_id || null;
this.devices = Array.isArray(data.devices) ? data.devices : [];
@@ -1940,7 +2045,7 @@ document.addEventListener('alpine:init', () => {
},
async loadFedDevices() {
- if (playerOffline()) return;
+ if (deviceSyncUnavailable()) return;
const {signal} = playbackConnection;
try {
const res = await fetch('/api/player/fed-devices', {signal});
@@ -2062,7 +2167,7 @@ document.addEventListener('alpine:init', () => {
},
async select(deviceId) {
- if (!deviceId || playerOffline()) return;
+ if (!deviceId || deviceSyncUnavailable()) return;
const player = Alpine.store('player');
try {
@@ -2086,7 +2191,7 @@ document.addEventListener('alpine:init', () => {
},
async sendCommand(command, payload = {}, targetDeviceId = null) {
- if (playerOffline()) return false;
+ if (deviceSyncUnavailable()) return false;
const jamId = this.isControllingRemoteJam() ? this.currentJamId : null;
const target = jamId ? null : (targetDeviceId || this.activeDeviceId);
if (!jamId && (!target || target === this.id)) return false;
diff --git a/templates/player/shell.html b/templates/player/shell.html
index 376aa9b..16d3e43 100644
--- a/templates/player/shell.html
+++ b/templates/player/shell.html
@@ -214,7 +214,7 @@
-
+