Added remux support for extensionless urls

This commit is contained in:
Trevor Mears
2025-12-31 09:55:48 -08:00
parent a90ac32a3b
commit 404364b904
+17 -11
View File
@@ -313,19 +313,23 @@ class VideoPlayer {
this.isUsingProxy = needsProxy; this.isUsingProxy = needsProxy;
const finalUrl = needsProxy ? this.getProxiedUrl(streamUrl) : streamUrl; const finalUrl = needsProxy ? this.getProxiedUrl(streamUrl) : streamUrl;
// Detect if this is likely an HLS stream (vs direct video file like MP4) // Detect if this is likely an HLS stream (has .m3u8 in URL)
// Note: .ts files are raw MPEG-TS, NOT HLS manifests - exclude them const looksLikeHls = finalUrl.includes('.m3u8') || finalUrl.includes('m3u8');
const looksLikeHls = finalUrl.includes('.m3u8') ||
finalUrl.includes('m3u8') ||
(!finalUrl.includes('.mp4') && !finalUrl.includes('.mkv') &&
!finalUrl.includes('.avi') && !finalUrl.includes('.ts'));
// Check for raw TS streams that browsers can't play directly // Check if this looks like a raw stream (no HLS manifest, no common video extensions)
// This includes .ts files AND extension-less URLs that might be TS streams
const isRawTs = finalUrl.includes('.ts') && !finalUrl.includes('.m3u8'); const isRawTs = finalUrl.includes('.ts') && !finalUrl.includes('.m3u8');
if (isRawTs) { const isExtensionless = !finalUrl.includes('.m3u8') &&
// If Force Remux is enabled, route through remux endpoint !finalUrl.includes('.mp4') &&
if (this.settings.forceRemux) { !finalUrl.includes('.mkv') &&
console.log('[Player] Raw TS stream detected. Using remux to convert to MP4...'); !finalUrl.includes('.avi') &&
!finalUrl.includes('.ts');
// Force Remux: Route through FFmpeg for container conversion
// Applies to: 1) .ts streams when detected, or 2) ALL non-HLS streams when enabled
if (this.settings.forceRemux && (isRawTs || isExtensionless)) {
console.log('[Player] Force Remux enabled. Routing through FFmpeg remux...');
console.log('[Player] Stream type:', isRawTs ? 'Raw TS' : 'Extension-less (assumed TS)');
const remuxUrl = this.getRemuxUrl(streamUrl); const remuxUrl = this.getRemuxUrl(streamUrl);
this.video.src = remuxUrl; this.video.src = remuxUrl;
this.video.play().catch(e => console.log('[Player] Autoplay prevented:', e)); this.video.play().catch(e => console.log('[Player] Autoplay prevented:', e));
@@ -338,6 +342,8 @@ class VideoPlayer {
return; return;
} }
// If raw TS detected without Force Remux enabled, show error
if (isRawTs && !this.settings.forceRemux) {
console.warn('[Player] Raw MPEG-TS stream detected. Browsers cannot play .ts files directly.'); console.warn('[Player] Raw MPEG-TS stream detected. Browsers cannot play .ts files directly.');
this.showError( this.showError(
'This stream uses raw MPEG-TS format (.ts) which browsers cannot play directly.<br><br>' + 'This stream uses raw MPEG-TS format (.ts) which browsers cannot play directly.<br><br>' +