Update MPEG-TS IPTV handling to use native playback
Changed protocol detection for direct .ts IPTV streams from 'hls' to 'native', reflecting that modern browsers can play MPEG-TS streams without a special player. Updated documentation, README, and tests to clarify browser support and recommend requesting .m3u8 links for best compatibility.
This commit is contained in:
+36
-5
@@ -501,14 +501,13 @@ https://cdn.jsdelivr.net/npm/hls.js@1.5.13
|
||||
- Media hataları → HLS instance yeniden başlatma
|
||||
- Fatal hataları → Error state'e düşme
|
||||
|
||||
#### 3. RTMP/FLV/IPTV Streaming
|
||||
#### 3. RTMP/FLV Streaming
|
||||
|
||||
**Desteklenen Protokoller:**
|
||||
- RTMP (rtmp://)
|
||||
- RTMPS (rtmps://)
|
||||
- RTMPT (rtmpt://)
|
||||
- HTTP-FLV (.flv veya flv? query)
|
||||
- MPEG-TS (.ts) - IPTV streams
|
||||
|
||||
**Kütüphane:** flv.js (opsiyonel, lazy-loaded)
|
||||
|
||||
@@ -538,14 +537,46 @@ https://cdn.jsdelivr.net/npm/flv.js@1.6.2
|
||||
|
||||
// RTMP (HTTP-FLV proxy gerektirir)
|
||||
<VideoPlayer src="rtmp://example.com/live/stream" />
|
||||
```
|
||||
|
||||
// IPTV (MPEG-TS)
|
||||
#### 4. IPTV (MPEG-TS) Streaming
|
||||
|
||||
**Desteklenen Format:**
|
||||
- MPEG-TS (.ts) - Direct transport stream files
|
||||
|
||||
**Kütüphane:** Yok (Native HTML5 video element)
|
||||
|
||||
**Özellikler:**
|
||||
- Doğrudan HTTP üzerinden TS stream oynatma
|
||||
- Canlı IPTV kanalları için ideal
|
||||
- Ek kütüphane gerekmez
|
||||
|
||||
**Tarayıcı Desteği:**
|
||||
- ⚠️ **Sınırlı destek**: Tüm tarayıcılar MPEG-TS formatını desteklemez
|
||||
- ✅ **Chrome/Edge**: Genellikle destekler
|
||||
- ⚠️ **Firefox**: Sınırlı destek
|
||||
- ⚠️ **Safari**: Sınırlı destek
|
||||
- ℹ️ **Alternatif**: M3U8 playlist üzerinden IPTV kullanımı önerilir
|
||||
|
||||
**Kullanım:**
|
||||
```tsx
|
||||
// IPTV (MPEG-TS) - Direct stream
|
||||
<VideoPlayer
|
||||
src="http://favoritv65.xyz:8080/live/username/password/98925.ts"
|
||||
src="http://server.com:8080/live/username/password/12345.ts"
|
||||
poster="http://example.com/channel-logo.png"
|
||||
onError={(error) => {
|
||||
console.error('IPTV stream error:', error)
|
||||
// Tarayıcı MPEG-TS desteklemiyorsa kullanıcıyı bilgilendir
|
||||
}}
|
||||
/>
|
||||
```
|
||||
|
||||
**ÖNEMLİ NOTLAR:**
|
||||
1. **Tarayıcı Uyumluluğu**: Tüm tarayıcılar `.ts` dosyalarını doğrudan oynatamaz
|
||||
2. **Alternatif Çözüm**: Mümkünse IPTV sağlayıcınızdan `.m3u8` (HLS) link isteyin
|
||||
3. **CORS**: IPTV sunucusu CORS ayarlarını doğru yapılandırmalıdır
|
||||
4. **Performans**: Doğrudan TS stream'ler bazı cihazlarda yavaş olabilir
|
||||
|
||||
**HTTP-FLV Proxy Örneği (Node.js):**
|
||||
```javascript
|
||||
// RTMP stream'i HTTP-FLV'ye dönüştüren proxy
|
||||
@@ -559,7 +590,7 @@ ffmpeg('rtmp://source.com/live/stream')
|
||||
.pipe(res);
|
||||
```
|
||||
|
||||
#### 4. DASH Support (Planlanıyor)
|
||||
#### 5. DASH Support (Planlanıyor)
|
||||
|
||||
**Durum:** Protokol tespit ediliyor ancak henüz implement edilmemiş
|
||||
|
||||
|
||||
@@ -150,9 +150,14 @@ function App() {
|
||||
### IPTV Streaming
|
||||
|
||||
```tsx
|
||||
// Note: Browser support for direct .ts streams is limited
|
||||
// For best compatibility, request .m3u8 (HLS) links from your IPTV provider
|
||||
<VideoPlayer
|
||||
src="http://server.com:8080/live/username/password/12345.ts"
|
||||
poster="http://example.com/channel-logo.png"
|
||||
onError={(error) => {
|
||||
console.error('Stream error - try requesting .m3u8 format:', error)
|
||||
}}
|
||||
/>
|
||||
```
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ describe('videoProtocol', () => {
|
||||
describe('detectVideoProtocol', () => {
|
||||
it('should detect MPEG-TS IPTV streams', () => {
|
||||
const result = detectVideoProtocol('http://favoritv65.xyz:8080/live/Apollon45/HpjWrDa6gWWd/98925.ts')
|
||||
expect(result.protocol).toBe('hls')
|
||||
expect(result.protocol).toBe('native')
|
||||
expect(result.isLive).toBe(true)
|
||||
expect(result.needsSpecialPlayer).toBe(true)
|
||||
expect(result.needsSpecialPlayer).toBe(false)
|
||||
})
|
||||
|
||||
it('should detect .ts files with query parameters', () => {
|
||||
const result = detectVideoProtocol('http://example.com/stream/video.ts?token=abc123')
|
||||
expect(result.protocol).toBe('hls')
|
||||
expect(result.protocol).toBe('native')
|
||||
expect(result.isLive).toBe(true)
|
||||
expect(result.needsSpecialPlayer).toBe(true)
|
||||
expect(result.needsSpecialPlayer).toBe(false)
|
||||
})
|
||||
|
||||
it('should detect HLS streams', () => {
|
||||
@@ -75,8 +75,8 @@ describe('videoProtocol', () => {
|
||||
expect(isHlsStream('http://example.com/stream.m3u8')).toBe(true)
|
||||
})
|
||||
|
||||
it('should return true for IPTV .ts streams', () => {
|
||||
expect(isHlsStream('http://favoritv65.xyz:8080/live/user/pass/98925.ts')).toBe(true)
|
||||
it('should return false for IPTV .ts streams (they are native, not HLS)', () => {
|
||||
expect(isHlsStream('http://favoritv65.xyz:8080/live/user/pass/98925.ts')).toBe(false)
|
||||
})
|
||||
|
||||
it('should return false for non-HLS streams', () => {
|
||||
|
||||
@@ -73,11 +73,12 @@ export const detectVideoProtocol = (src: string): ProtocolDetectionResult => {
|
||||
|
||||
// MPEG-TS (IPTV) detection
|
||||
// Check for .ts extension (Transport Stream used in IPTV)
|
||||
// Note: These are direct TS streams, not HLS playlists, so we use native playback
|
||||
if (lowerSrc.includes('.ts') || lowerSrc.match(/\.ts(\?|$)/)) {
|
||||
return {
|
||||
protocol: 'hls', // HLS player can handle MPEG-TS streams
|
||||
protocol: 'native', // Use native video element for direct TS streams
|
||||
isLive: true, // IPTV streams are typically live
|
||||
needsSpecialPlayer: true,
|
||||
needsSpecialPlayer: false, // Modern browsers can handle MPEG-TS directly
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user