diff --git a/static/js/podcasts-web.js b/static/js/podcasts-web.js index 108da64..519ad2f 100644 --- a/static/js/podcasts-web.js +++ b/static/js/podcasts-web.js @@ -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(); }); diff --git a/static/js/sw.js b/static/js/sw.js index 5fe14c6..9e77855 100644 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -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',