chore: optimize IPTV performance and fix navigation Loop

- Revert aggressive caching in XtreamService (use forceCache + 1h stale)
- Adjust HLS.js buffers (60s-120s) for stream stability
- Fix desktop navigation loop in PlaylistSelectionScreen
- Fix receive timeouts (revert to 30s/60s)
This commit is contained in:
Michael committed 2026-03-10 18:28:10 +01:00
1 parent 8c65e48bbe
commit 736ab0f51c
3 files changed
+14 -14

No files matched your search

@@ -18,9 +18,9 @@ class XtreamService {
XtreamService() { XtreamService() {
_dio = Dio( _dio = Dio(
BaseOptions( BaseOptions(
connectTimeout: const Duration(seconds: 300), connectTimeout: const Duration(seconds: 30),
receiveTimeout: const Duration(seconds: 300), receiveTimeout: const Duration(seconds: 60),
sendTimeout: const Duration(seconds: 300), sendTimeout: const Duration(seconds: 60),
), ),
); );
@@ -28,8 +28,8 @@ class XtreamService {
// Use MemCacheStore on Web to avoid path errors // Use MemCacheStore on Web to avoid path errors
_cacheOptions = CacheOptions( _cacheOptions = CacheOptions(
store: kIsWeb ? MemCacheStore() : HiveCacheStore('./cache'), store: kIsWeb ? MemCacheStore() : HiveCacheStore('./cache'),
policy: CachePolicy.refresh, // Allow refresh if stale policy: CachePolicy.forceCache, // Prioritize local cache
maxStale: const Duration(minutes: 15), // Reduced from 1h to 15m for better sync maxStale: const Duration(hours: 1), // Increase to 1h for stability
priority: CachePriority.high, priority: CachePriority.high,
); );
+4 -4
View File
@@ -243,11 +243,11 @@
} }
const hls = new Hls({ const hls = new Hls({
maxBufferLength: 30, // 30s is plenty for desktop stability maxBufferLength: 60, // Increased for better stability
maxMaxBufferLength: 60, maxMaxBufferLength: 120,
enableWorker: true, enableWorker: true,
liveSyncDurationCount: 3, liveSyncDurationCount: 5, // More stable sync
liveMaxLatencyDurationCount: 10, liveMaxLatencyDurationCount: 15,
lowLatencyMode: true lowLatencyMode: true
}); });
+5 -5
View File
@@ -229,12 +229,12 @@
if (isHLS && Hls.isSupported()) { if (isHLS && Hls.isSupported()) {
log('Using Hls.js optimized for mobile'); log('Using Hls.js optimized for mobile');
const hls = new Hls({ const hls = new Hls({
maxBufferLength: 30, maxBufferLength: 60, // More buffer for mobile stability
maxMaxBufferLength: 60, maxMaxBufferLength: 120,
liveSyncDurationCount: 3, liveSyncDurationCount: 5,
liveMaxLatencyDurationCount: 10, liveMaxLatencyDurationCount: 15,
enableWorker: true, enableWorker: true,
lowLatencyMode: true lowLatencyMode: false // Disable low latency for continuity
}); });
hls.loadSource(streamUrl); hls.loadSource(streamUrl);
hls.attachMedia(video); hls.attachMedia(video);