- New modern audio wave 'A' logo (192x192 and 512x512 icons) - PWA service worker for offline support and installability - Wake Lock API for background audio on FiiO/Android devices - Visibility change handling to prevent audio pause on screen off - Updated manifest.json with music categories and proper PWA config - Media Session API lock screen controls (already present) - Renamed app to 'Audiophile Web Player'
20 lines
566 B
TypeScript
20 lines
566 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
export default function ServiceWorkerRegistration() {
|
|
useEffect(() => {
|
|
if ("serviceWorker" in navigator) {
|
|
navigator.serviceWorker
|
|
.register("/sw.js")
|
|
.then((registration) => {
|
|
console.log("Service Worker registered:", registration.scope);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Service Worker registration failed:", error);
|
|
});
|
|
}
|
|
}, []);
|
|
|
|
return null;
|
|
}
|