mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 06:58:05 +02:00
feat: add Xtream service for IPTV integration and a lite player HTML file.
This commit is contained in:
1 parent
781f58cb38
commit
a7ca1a087f
2 files changed
+12
-15
No files matched your search
@@ -37,10 +37,15 @@ class XtreamService {
|
|||||||
return html.window.location.protocol == 'https:';
|
return html.window.location.protocol == 'https:';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wrap URL with proxy if needed (for HTTPS to HTTP bridge)
|
/// Wrap URL with proxy for all external IPTV URLs
|
||||||
|
///
|
||||||
|
/// Always use proxy for HTTP URLs to:
|
||||||
|
/// 1. Handle HTTPS->HTTP mixed content
|
||||||
|
/// 2. Provide Range header support for seeking
|
||||||
|
/// 3. Normalize headers and handle redirects
|
||||||
String _wrapWithProxy(String url) {
|
String _wrapWithProxy(String url) {
|
||||||
// If we're on HTTPS and the target URL is HTTP, use the proxy
|
// Always proxy HTTP URLs for consistent streaming behavior
|
||||||
if (_isHttps && url.startsWith('http://')) {
|
if (url.startsWith('http://')) {
|
||||||
final baseUrl = html.window.location.origin;
|
final baseUrl = html.window.location.origin;
|
||||||
return '$baseUrl/api/xtream/$url';
|
return '$baseUrl/api/xtream/$url';
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-12
@@ -361,18 +361,11 @@
|
|||||||
log('Stream type: ' + streamType);
|
log('Stream type: ' + streamType);
|
||||||
const lowerUrl = streamUrl.toLowerCase();
|
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 (streamUrl.includes('/api/stream/')) {
|
||||||
if (streamType === 'live') {
|
// Both Live TV and VOD use /api/stream/ which returns JSON with HLS playlist URL
|
||||||
// LIVE TV: Use MPEG-TS direct streaming
|
log((streamType === 'live' ? 'Live TV' : 'VOD') + ' via /api/stream/ - fetching HLS...');
|
||||||
log('Live TV via /api/stream/ - using MPEG-TS direct');
|
showLoading(streamType === 'live' ? 'Connecting to live stream...' : 'Initializing stream...');
|
||||||
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 {
|
try {
|
||||||
const response = await fetch(streamUrl);
|
const response = await fetch(streamUrl);
|
||||||
@@ -394,7 +387,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Use type parameter if available, otherwise detect from URL
|
// Use type parameter if available, otherwise detect from URL
|
||||||
if (streamType === 'vod') {
|
if (streamType === 'vod') {
|
||||||
|
|||||||
Reference in new issue
Block a user