Podcast-Player: abgelaufene Download-Links überstehen
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:
parent
de1940b4e5
commit
1d6ddabb7b
2 changed files with 16 additions and 2 deletions
|
|
@ -920,12 +920,26 @@
|
|||
applyKind();
|
||||
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', () => {
|
||||
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);
|
||||
wantPlay = false;
|
||||
buffering = false;
|
||||
toast('Diese Folge lässt sich gerade nicht abspielen');
|
||||
if (play) toast('Diese Folge lässt sich gerade nicht abspielen');
|
||||
report();
|
||||
syncSoon();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* diora service worker — caches the app shell for offline use.
|
||||
*/
|
||||
|
||||
const CACHE = 'diora-v110';
|
||||
const CACHE = 'diora-v111';
|
||||
const SHELL = [
|
||||
'/static/css/app.css',
|
||||
'/static/js/app/01-core.js',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue