push
This commit is contained in:
+16
-1
@@ -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 };
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user