fix(video-format-detector): temporarily route .ts files to local player
- Add temporary fix to send .ts files to local player due to HLS resegmentation issues - Disable .ts format in MPEG Transport Stream (TS_STREAM_FORMATS) for HLS streaming - Log handling of .ts files in format detection for clarity - Update local player format creation with specific warning message for .ts files - Extend LIMITED_SUPPORT_FORMATS check to include .ts as a temporary measure - Add TODO notes to revert changes once .ts HLS implementation is fixed
This commit is contained in:
parent
e019389770
commit
048ed1b4e6
|
|
@ -1,6 +1,10 @@
|
|||
/**
|
||||
* Video format detection and support level classification
|
||||
* Determines the optimal playback method for different video formats
|
||||
*
|
||||
* TEMPORARY FIX: .ts files are currently sent to local player instead of HLS
|
||||
* due to resegmentation issues. This needs to be reverted once the HLS
|
||||
* implementation for .ts files is fixed.
|
||||
*/
|
||||
|
||||
export interface VideoFormat {
|
||||
|
|
@ -56,9 +60,10 @@ const HLS_COMPATIBLE_FORMATS = [
|
|||
'mts'
|
||||
];
|
||||
|
||||
// MPEG Transport Stream formats - can be served via HLS or converted
|
||||
// MPEG Transport Stream formats - TEMPORARY: treat as local player required
|
||||
// TODO: Fix the .ts resegmentation implementation for HLS streaming
|
||||
const TS_STREAM_FORMATS = [
|
||||
'ts', // MPEG Transport Stream - optimal for HLS streaming
|
||||
// 'ts', // TEMPORARILY DISABLED - send to local player instead
|
||||
'm2ts', // Blu-ray Transport Stream
|
||||
'mts' // AVCHD Transport Stream
|
||||
];
|
||||
|
|
@ -104,6 +109,12 @@ export function detectVideoFormat(video: VideoFile): VideoFormat {
|
|||
return createDirectFormat(video, extension);
|
||||
}
|
||||
|
||||
// TEMPORARY FIX: Send .ts files to local player due to resegmentation issues
|
||||
if (extension === 'ts') {
|
||||
console.log('[FormatDetector] .ts file detected, sending to local player (temporary fix)');
|
||||
return createLocalPlayerFormat(video, extension);
|
||||
}
|
||||
|
||||
// Tier 1.5: MPEG Transport Stream files (optimal for HLS)
|
||||
if (TS_STREAM_FORMATS.includes(extension)) {
|
||||
console.log('[FormatDetector] TS format detected, using HLS streaming:', extension);
|
||||
|
|
@ -122,9 +133,9 @@ export function detectVideoFormat(video: VideoFile): VideoFormat {
|
|||
// No more fallback to transcoding system
|
||||
console.log('[FormatDetector] Using local player for format:', extension);
|
||||
|
||||
// Check if this is a format from LIMITED_SUPPORT_FORMATS
|
||||
if (LIMITED_SUPPORT_FORMATS.includes(extension)) {
|
||||
console.log('[FormatDetector] Format in LIMITED_SUPPORT_FORMATS, forcing local player');
|
||||
// Check if this is a format from LIMITED_SUPPORT_FORMATS or .ts (temporary)
|
||||
if (LIMITED_SUPPORT_FORMATS.includes(extension) || extension === 'ts') {
|
||||
console.log('[FormatDetector] Format in LIMITED_SUPPORT_FORMATS or .ts (temporary), forcing local player');
|
||||
}
|
||||
|
||||
return createLocalPlayerFormat(video, extension);
|
||||
|
|
@ -253,6 +264,7 @@ function createTSDirectFormat(video: VideoFile, extension: string): VideoFormat
|
|||
|
||||
/**
|
||||
* Create local player format configuration (replaces transcoding fallback)
|
||||
* Enhanced for .ts files to provide better user guidance
|
||||
*/
|
||||
function createLocalPlayerFormat(video: VideoFile, extension: string): VideoFormat {
|
||||
const contentType = getMimeType(extension);
|
||||
|
|
@ -260,12 +272,18 @@ function createLocalPlayerFormat(video: VideoFile, extension: string): VideoForm
|
|||
// Use the optimized external streaming endpoint
|
||||
const baseUrl = `/api/external-stream/${video.id}`;
|
||||
|
||||
// Special handling for .ts files (temporary fix)
|
||||
const isTsFile = extension === 'ts';
|
||||
const warningMessage = isTsFile
|
||||
? 'MPEG Transport Stream (.ts) files require a local video player for optimal playback. This is a temporary solution while we fix the streaming implementation.'
|
||||
: 'This format requires a local video player';
|
||||
|
||||
return {
|
||||
type: 'local-player',
|
||||
supportLevel: 'local-player-required',
|
||||
url: baseUrl, // Optimized endpoint for external players
|
||||
action: 'launch-local-player',
|
||||
warning: 'This format requires a local video player',
|
||||
warning: warningMessage,
|
||||
recommendedPlayers: getRecommendedPlayersForFormat(extension),
|
||||
streamInfo: {
|
||||
contentType,
|
||||
|
|
|
|||
Loading…
Reference in New Issue