mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: Add IPTV player HTML pages with HLS/MPEG-TS support and parent communication.
This commit is contained in:
1 parent
b2298a9bf4
commit
781f58cb38
2 files changed
+56
-36
No files matched your search
+29
-17
@@ -511,28 +511,40 @@
|
||||
|
||||
log('Stream URL: ' + streamUrl.substring(0, 80) + '...');
|
||||
|
||||
// SPECIAL: /api/stream/ returns JSON with HLS playlist URL
|
||||
// SPECIAL: /api/stream/ endpoint - differentiate Live vs VOD
|
||||
if (streamUrl.includes('/api/stream/')) {
|
||||
log('Detected /api/stream/ - fetching HLS playlist...');
|
||||
showLoading('Initializing stream (transcoding audio)...');
|
||||
// Check if this is a live stream (URL param check since player.html doesn't have type param by default)
|
||||
const isLiveStream = streamUrl.includes('live') || urlParams.get('type') === 'live';
|
||||
|
||||
try {
|
||||
const response = await fetch(streamUrl);
|
||||
const data = await response.json();
|
||||
if (isLiveStream) {
|
||||
// LIVE TV: Use MPEG-TS direct streaming
|
||||
log('Live TV via /api/stream/ - using MPEG-TS');
|
||||
showLoading('Connecting to live stream...');
|
||||
await playWithMpegTS(streamUrl);
|
||||
return;
|
||||
} else {
|
||||
// VOD: Fetch JSON to get HLS playlist (transcoding mode)
|
||||
log('VOD via /api/stream/ - fetching HLS...');
|
||||
showLoading('Initializing stream (transcoding audio)...');
|
||||
|
||||
if (data.playlist) {
|
||||
const playlistUrl = window.location.origin + data.playlist;
|
||||
log('Playing HLS: ' + playlistUrl);
|
||||
await playWithHLS(playlistUrl);
|
||||
return;
|
||||
} else {
|
||||
showError('Invalid stream response');
|
||||
try {
|
||||
const response = await fetch(streamUrl);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.playlist) {
|
||||
const playlistUrl = window.location.origin + data.playlist;
|
||||
log('Playing HLS: ' + playlistUrl);
|
||||
await playWithHLS(playlistUrl);
|
||||
return;
|
||||
} else {
|
||||
showError('Invalid stream response');
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
log('Error: ' + err);
|
||||
showError('Stream init failed');
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
log('Error: ' + err);
|
||||
showError('Stream init failed');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-19
@@ -361,30 +361,38 @@
|
||||
log('Stream type: ' + streamType);
|
||||
const lowerUrl = streamUrl.toLowerCase();
|
||||
|
||||
// SPECIAL: /api/stream/ endpoint returns JSON with HLS playlist URL
|
||||
// SPECIAL: /api/stream/ endpoint handling - differentiate Live vs VOD
|
||||
if (streamUrl.includes('/api/stream/')) {
|
||||
log('Detected /api/stream/ - fetching HLS playlist URL...');
|
||||
showLoading('Initializing stream (transcoding audio)...');
|
||||
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)...');
|
||||
|
||||
try {
|
||||
// Fetch JSON response to get playlist URL
|
||||
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');
|
||||
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;
|
||||
}
|
||||
} catch (err) {
|
||||
log('Error fetching playlist: ' + err);
|
||||
showError('Failed to initialize stream');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user