Add IPTV (.ts) stream support and tests

Introduced detection and support for MPEG-TS (.ts) IPTV streams in videoProtocol, updated documentation and examples to reflect IPTV support, and added comprehensive tests for protocol detection. Mock implementations for flv.js and hls.js were added for testing, and vitest config now aliases these libraries to their mocks.
This commit is contained in:
hibna
2025-11-04 05:24:21 +03:00
parent e3b2d396e1
commit becc9efc7f
9 changed files with 204 additions and 4 deletions
+10
View File
@@ -71,6 +71,16 @@ export const detectVideoProtocol = (src: string): ProtocolDetectionResult => {
}
}
// MPEG-TS (IPTV) detection
// Check for .ts extension (Transport Stream used in IPTV)
if (lowerSrc.includes('.ts') || lowerSrc.match(/\.ts(\?|$)/)) {
return {
protocol: 'hls', // HLS player can handle MPEG-TS streams
isLive: true, // IPTV streams are typically live
needsSpecialPlayer: true,
}
}
// Native HTML5 video formats (MP4, WebM, OGG, etc.)
return {
protocol: 'native',