mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: add Xtream service for IPTV integration and a lite player HTML file.
This commit is contained in:
1 parent
610c0064c1
commit
e0c3ff2be9
2 files changed
+27
-30
No files matched your search
+19
-27
@@ -361,38 +361,30 @@
|
||||
log('Stream type: ' + streamType);
|
||||
const lowerUrl = streamUrl.toLowerCase();
|
||||
|
||||
// SPECIAL: /api/stream/ endpoint handling - differentiate Live vs VOD
|
||||
// SPECIAL: /api/stream/ endpoint handling - ALWAYS returns JSON with HLS playlist
|
||||
if (streamUrl.includes('/api/stream/')) {
|
||||
if (streamType === 'live') {
|
||||
// LIVE TV: Use MPEG-TS direct streaming
|
||||
log('Live TV via /api/stream/ - using MPEG-TS direct');
|
||||
showLoading('Connecting to live stream...');
|
||||
await playWithMpegTS(streamUrl, true); // isLive=true
|
||||
return;
|
||||
} else {
|
||||
// VOD: Fetch JSON to get HLS playlist URL (transcoding mode)
|
||||
log('VOD via /api/stream/ - fetching HLS playlist...');
|
||||
showLoading('Initializing stream (transcoding audio)...');
|
||||
// Both Live TV and VOD use /api/stream/ which returns JSON with HLS playlist URL
|
||||
log((streamType === 'live' ? 'Live TV' : 'VOD') + ' via /api/stream/ - fetching HLS...');
|
||||
showLoading(streamType === 'live' ? 'Connecting to live stream...' : 'Initializing stream...');
|
||||
|
||||
try {
|
||||
const response = await fetch(streamUrl);
|
||||
const data = await response.json();
|
||||
try {
|
||||
const response = await fetch(streamUrl);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.playlist) {
|
||||
const playlistUrl = window.location.origin + data.playlist;
|
||||
log('Got HLS playlist: ' + playlistUrl);
|
||||
showLoading('Loading HLS stream...');
|
||||
await playWithHLS(playlistUrl);
|
||||
return;
|
||||
} else {
|
||||
showError('Invalid stream response');
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
log('Error fetching playlist: ' + err);
|
||||
showError('Failed to initialize stream');
|
||||
if (data.playlist) {
|
||||
const playlistUrl = window.location.origin + data.playlist;
|
||||
log('Got HLS playlist: ' + playlistUrl);
|
||||
showLoading('Loading HLS stream...');
|
||||
await playWithHLS(playlistUrl);
|
||||
return;
|
||||
} else {
|
||||
showError('Invalid stream response');
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
log('Error fetching playlist: ' + err);
|
||||
showError('Failed to initialize stream');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user