This commit is contained in:
4DBug
2026-08-26 20:39:37 -05:00
parent 735f9a4375
commit bbb5659e00
7 changed files with 134 additions and 22 deletions
+16 -1
View File
@@ -50,6 +50,21 @@
return url.replace(/\/t\/p\/[A-Za-z0-9._-]+/, `/t/p/${size}`);
}
// True when the in-browser player can load the stream through the proxy.
function webPlayable(stream) {
const s = stream || {};
const url = String(s.url || '');
if (!/^https?:\/\//i.test(url)) return false;
const type = String(s.type || '').toLowerCase();
if (['magnet', 'torrent', 'dash', 'mkv', 'avi'].includes(type)) return false;
const isHls = type === 'm3u8' || /\.m3u8($|\?)/i.test(url);
const isDirect =
type === 'mp4' ||
type === 'webm' ||
/\.(mp4|m4v|webm)(\?|#|$)/i.test(url);
return isHls || isDirect;
}
window.SR = window.SR || {};
SR.util = { escapeHtml, getParam, formatSeconds, runtimeLabel, debounce, tmdbResize };
SR.util = { escapeHtml, getParam, formatSeconds, runtimeLabel, debounce, tmdbResize, webPlayable };
})();