Added remux support for extensionless urls
This commit is contained in:
@@ -313,31 +313,37 @@ 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') &&
|
||||||
const remuxUrl = this.getRemuxUrl(streamUrl);
|
!finalUrl.includes('.ts');
|
||||||
this.video.src = remuxUrl;
|
|
||||||
this.video.play().catch(e => console.log('[Player] Autoplay prevented:', e));
|
|
||||||
|
|
||||||
// Update UI and dispatch events
|
// Force Remux: Route through FFmpeg for container conversion
|
||||||
this.updateNowPlaying(channel);
|
// Applies to: 1) .ts streams when detected, or 2) ALL non-HLS streams when enabled
|
||||||
this.showNowPlayingOverlay();
|
if (this.settings.forceRemux && (isRawTs || isExtensionless)) {
|
||||||
this.fetchEpgData(channel);
|
console.log('[Player] Force Remux enabled. Routing through FFmpeg remux...');
|
||||||
window.dispatchEvent(new CustomEvent('channelChanged', { detail: channel }));
|
console.log('[Player] Stream type:', isRawTs ? 'Raw TS' : 'Extension-less (assumed TS)');
|
||||||
return;
|
const remuxUrl = this.getRemuxUrl(streamUrl);
|
||||||
}
|
this.video.src = remuxUrl;
|
||||||
|
this.video.play().catch(e => console.log('[Player] Autoplay prevented:', e));
|
||||||
|
|
||||||
|
// Update UI and dispatch events
|
||||||
|
this.updateNowPlaying(channel);
|
||||||
|
this.showNowPlayingOverlay();
|
||||||
|
this.fetchEpgData(channel);
|
||||||
|
window.dispatchEvent(new CustomEvent('channelChanged', { detail: channel }));
|
||||||
|
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>' +
|
||||||
|
|||||||
Reference in New Issue
Block a user