Podcast-Player: abgelaufene Download-Links überstehen
All checks were successful
Build and push Docker image / build (push) Successful in 15s
Test / test (push) Successful in 8m24s
Test / e2e (push) Successful in 1m48s

SoundCloud leitet die Feed-Adresse auf einen signierten Link um, der nach
zwei Minuten abläuft. Das Audio-Element fragt für jeden weiteren Teil der
Datei diesen Link an, wird abgewiesen (MEDIA_ERR_NETWORK) und blieb danach
kaputt, bis die App neu startete. Jetzt wird die Folge bei einem Fehler an
derselben Stelle neu geladen (bis zu dreimal pro Minute), und nach dem
Aufgeben beim nächsten Abspielen frisch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mrwnslz 2026-10-15 14:28:37 +02:00
parent de1940b4e5
commit 1d6ddabb7b
2 changed files with 16 additions and 2 deletions

View file

@ -920,12 +920,26 @@
applyKind(); applyKind();
report(); report();
}); });
// Some hosts hand out a signed address that runs out within minutes (SoundCloud: 2).
// The element keeps asking that one for the next part of the file and gets refused:
// loaded anew from the feed's address (a fresh link) at the same place, it plays on.
// An element that failed can't play again, so after giving up it's loaded anew on play.
let failures = 0;
let failedAt = 0;
audio.addEventListener('error', () => { audio.addEventListener('error', () => {
if (!loaded || !audio.getAttribute('src')) return; if (!loaded || !audio.getAttribute('src')) return;
const at = posMs();
const play = wantPlay;
if (Date.now() - failedAt > 60000) failures = 0;
failedAt = Date.now();
loaded = false;
startAt = at;
mustReach = null;
if (play && ++failures <= 3) { resume(); return; }
error = 'MEDIA_ERR_' + (audio.error ? audio.error.code : 0); error = 'MEDIA_ERR_' + (audio.error ? audio.error.code : 0);
wantPlay = false; wantPlay = false;
buffering = false; buffering = false;
toast('Diese Folge lässt sich gerade nicht abspielen'); if (play) toast('Diese Folge lässt sich gerade nicht abspielen');
report(); report();
syncSoon(); syncSoon();
}); });

View file

@ -2,7 +2,7 @@
* diora service worker — caches the app shell for offline use. * diora service worker — caches the app shell for offline use.
*/ */
const CACHE = 'diora-v110'; const CACHE = 'diora-v111';
const SHELL = [ const SHELL = [
'/static/css/app.css', '/static/css/app.css',
'/static/js/app/01-core.js', '/static/js/app/01-core.js',