fix(node-player): use blob for audio stream, keep SW for cover art

<audio> elements with Sec-Fetch-Mode: no-cors are unreliable with
Service Workers across browsers. Revert stream to blob download via
axios (Bearer token works). SW remains for cover art in <img> tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ultradesu
2026-04-08 17:45:54 +01:00
parent c11b71a0ef
commit d3aba1152c
@@ -1,4 +1,4 @@
import { API_ROOT } from './furumiApi' import { furumiApi } from './furumiApi'
import { fmt } from './utils' import { fmt } from './utils'
const MAX_PLAYBACK_ERROR_SKIPS = 5 const MAX_PLAYBACK_ERROR_SKIPS = 5
@@ -109,8 +109,13 @@ export function attachAudioPlayback(
volSlider?.addEventListener('input', onVolInput) volSlider?.addEventListener('input', onVolInput)
async function loadStreamForTrack(slug: string) { async function loadStreamForTrack(slug: string) {
audio.src = `${API_ROOT}/stream/${slug}` try {
await audio.play().catch(() => { }) const res = await furumiApi.get(`/stream/${slug}`, { responseType: 'blob' })
audio.src = URL.createObjectURL(res.data)
await audio.play().catch(() => { })
} catch {
// stream failed
}
} }
function pauseAndClearSource() { function pauseAndClearSource() {