Android-App v1.2.0: - Fix: 404-Fehler durch doppelten /tv/tv/ Pfad (URL-Bereinigung in SetupActivity) - Fix: Kein Ton - AudioAttributes (AUDIO_CONTENT_TYPE_MOVIE + handleAudioFocus) - Neu: ExoPlayer HLS-Support (playHLS) fuer DTS/TrueHD-Audio Fallback - Neu: Back-Taste auf Root-Seite -> zurueck zum Setup (Server aendern) - VKWebViewClient: playHLS in JS-Bridge exponiert Tizen-App: - Fix: Tonausfaelle bei Opus 6ch (Akte X) - canDirectPlay blockt Opus >2ch - Neu: AVPlay HLS-Fallback (playHLS) mit AAC 5.1 Surround-Erhalt - Neu: Buffer-Konfiguration (setBufferingParam) fuer stabilere Wiedergabe - VKNative-Bridge v2.0: playHLS in beiden Modi (postMessage + Direct AVPlay) Player: - Native-HLS Default Sound auf "surround" (AVPlay/ExoPlayer koennen 5.1) - PWA Direct-Play, Template-Fixes, UX-Verbesserungen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
/**
|
|
* VideoKonverter TV - Service Worker (minimal)
|
|
* Ermoeglicht PWA-Installation auf Handys und Tablets
|
|
* Kein Offline-Caching noetig (Streaming braucht Netzwerk)
|
|
*/
|
|
|
|
const CACHE_NAME = "vk-tv-v14";
|
|
const STATIC_ASSETS = [
|
|
"/static/tv/css/tv.css",
|
|
"/static/tv/js/tv.js",
|
|
"/static/tv/js/player.js",
|
|
"/static/tv/js/vknative-bridge.js",
|
|
"/static/tv/icons/icon-192.png",
|
|
];
|
|
|
|
// Installation: Statische Assets cachen
|
|
self.addEventListener("install", (event) => {
|
|
event.waitUntil(
|
|
caches.open(CACHE_NAME)
|
|
.then(cache => cache.addAll(STATIC_ASSETS))
|
|
.then(() => self.skipWaiting())
|
|
);
|
|
});
|
|
|
|
// Aktivierung: Alte Caches aufraemen
|
|
self.addEventListener("activate", (event) => {
|
|
event.waitUntil(
|
|
caches.keys()
|
|
.then(keys => Promise.all(
|
|
keys.filter(k => k !== CACHE_NAME)
|
|
.map(k => caches.delete(k))
|
|
))
|
|
.then(() => self.clients.claim())
|
|
);
|
|
});
|
|
|
|
// Fetch: Network-First Strategie (Streaming braucht immer Netzwerk)
|
|
self.addEventListener("fetch", (event) => {
|
|
// Nur GET-Requests cachen
|
|
if (event.request.method !== "GET") return;
|
|
|
|
// API-Requests und Streaming nie cachen
|
|
const url = new URL(event.request.url);
|
|
if (url.pathname.startsWith("/api/") || url.pathname.startsWith("/tv/api/")
|
|
|| url.pathname.includes("/stream") || url.pathname.includes("/direct-stream")) {
|
|
return;
|
|
}
|
|
|
|
// Statische Assets: Cache-First
|
|
if (url.pathname.startsWith("/static/tv/")) {
|
|
event.respondWith(
|
|
caches.match(event.request)
|
|
.then(cached => cached || fetch(event.request)
|
|
.then(response => {
|
|
const clone = response.clone();
|
|
caches.open(CACHE_NAME)
|
|
.then(cache => cache.put(event.request, clone));
|
|
return response;
|
|
})
|
|
)
|
|
);
|
|
return;
|
|
}
|
|
|
|
// Alles andere: Network-First
|
|
event.respondWith(
|
|
fetch(event.request)
|
|
.catch(() => caches.match(event.request))
|
|
);
|
|
});
|