Record the listening after a handoff that did not go through
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f87d70c593
commit
056c53a808
2 files changed
+111
-2
No files matched your search
@@ -3048,11 +3048,16 @@ document.addEventListener('alpine:init', () => {
|
||||
async select(deviceId) {
|
||||
if (!deviceId) return;
|
||||
const player = Alpine.store('player');
|
||||
// The episode reported as handed off, until the transfer succeeds.
|
||||
let handedOff = null;
|
||||
|
||||
try {
|
||||
// Handing an episode to another device: save its position at
|
||||
// this session's generation first; the new device continues.
|
||||
if (deviceId !== this.id && this.isActive()) await player?._reportEpisode('handoff');
|
||||
if (deviceId !== this.id && this.isActive()) {
|
||||
handedOff = player?._episode || null;
|
||||
await player?._reportEpisode('handoff');
|
||||
}
|
||||
this.clearJamSelection();
|
||||
const res = await fetch('/api/player/devices/active', {
|
||||
method: 'POST',
|
||||
@@ -3067,6 +3072,7 @@ document.addEventListener('alpine:init', () => {
|
||||
this.selectError = res.status === 409 ? await this._errorText(res) : '';
|
||||
return;
|
||||
}
|
||||
handedOff = null;
|
||||
this.selectError = '';
|
||||
const data = await res.json();
|
||||
this._apply(data);
|
||||
@@ -3080,7 +3086,13 @@ document.addEventListener('alpine:init', () => {
|
||||
} else if (deviceId !== this.id && player && this.id !== this.activeDeviceId) {
|
||||
player._applyRemotePlaybackState(data.playback_state);
|
||||
}
|
||||
} catch {}
|
||||
} catch {
|
||||
} finally {
|
||||
// The transfer failed and this tab keeps playing: what it
|
||||
// listens from here on is recorded when it stops or loses
|
||||
// the playback role (see _endEpisode).
|
||||
if (handedOff) handedOff.handedOff = false;
|
||||
}
|
||||
},
|
||||
|
||||
async sendCommand(command, payload = {}, targetDeviceId = null) {
|
||||
|
||||
Reference in new issue
Block a user