Report client fingerprint on playback failure

showStreamError + playerFail now POST the failing browser's UA,
hls.js presence, MSE support and native-HLS capability to the
events table — a broken mobile browser becomes diagnosable from
the server side instead of by guessing.
This commit is contained in:
jozamudi committed 2026-08-31 19:57:57 +00:00
1 parent 8f6d4dcf77
commit be47ced521
2 files changed
+12 -3

No files matched your search

+10 -1
View File
@@ -70,6 +70,15 @@ function toast(msg, action) {
function showStreamError(msg, retry) { function showStreamError(msg, retry) {
// visible overlay + Retry — never leave a silent spinner (this is what // visible overlay + Retry — never leave a silent spinner (this is what
// an unplayable browser used to hit: 'HLS not supported' under the overlay) // an unplayable browser used to hit: 'HLS not supported' under the overlay)
// + report the client's capabilities so a failing browser is diagnosable
// from server.log instead of by guesswork
try {
postEvent({type: "client-fail", msg,
ua: navigator.userAgent,
hls_lib: typeof window.Hls,
mse: (window.Hls && Hls.isSupported) ? Hls.isSupported() : null,
native_hls: document.createElement("video").canPlayType("application/vnd.apple.mpegurl") || "none"});
} catch {}
playerOverlay("Stream error: " + msg, retry || (() => { if (currentEp) play(currentEp.ep_id, currentEp.ep_no); }), "Retry"); playerOverlay("Stream error: " + msg, retry || (() => { if (currentEp) play(currentEp.ep_id, currentEp.ep_no); }), "Retry");
} }
@@ -752,7 +761,7 @@ function playerFail(msg) {
// the last 10s save when they leave // the last 10s save when they leave
savePos(); savePos();
const { ep_id, ep_no } = currentEp; const { ep_id, ep_no } = currentEp;
postEvent({type: "error", detail: msg, ep_id, ep: ep_no, lang}); postEvent({type: "error", detail: msg, ep_id, ep: ep_no, lang, ua: navigator.userAgent});
playerOverlay("Playback failed: " + msg, () => play(ep_id, ep_no)); playerOverlay("Playback failed: " + msg, () => play(ep_id, ep_no));
} }
+2 -2
View File
@@ -6,7 +6,7 @@
<title>ani-web</title> <title>ani-web</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23f97316'/%3E%3Ctext x='32' y='45' font-family='sans-serif' font-size='42' font-weight='700' text-anchor='middle' fill='%230e0f13'%3Ea%3C/text%3E%3C/svg%3E"> <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23f97316'/%3E%3Ctext x='32' y='45' font-family='sans-serif' font-size='42' font-weight='700' text-anchor='middle' fill='%230e0f13'%3Ea%3C/text%3E%3C/svg%3E">
<link rel="stylesheet" href="style.css?v=7"> <link rel="stylesheet" href="style.css?v=8">
</head> </head>
<body> <body>
<header> <header>
@@ -30,6 +30,6 @@
max-age=300 in browser AND possibly in your HTTPS proxy, and a stale max-age=300 in browser AND possibly in your HTTPS proxy, and a stale
copy is exactly how users keep seeing an old UI after a deploy --> copy is exactly how users keep seeing an old UI after a deploy -->
<script src="hls.min.js"></script> <script src="hls.min.js"></script>
<script src="app.js?v=7"></script> <script src="app.js?v=8"></script>
</body> </body>
</html> </html>