mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 06:58:05 +02:00
feat(player): increase buffering and stability for HLS and MPEG-TS
This commit is contained in:
1 parent
b8682eafe0
commit
9e97f45046
2 files changed
+26
-22
No files matched your search
+12
-8
@@ -253,18 +253,18 @@
|
|||||||
const isTurbo = urlParams.get('turbo') === 'true';
|
const isTurbo = urlParams.get('turbo') === 'true';
|
||||||
|
|
||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
maxBufferLength: 60,
|
maxBufferLength: 120,
|
||||||
enableWorker: true,
|
enableWorker: true,
|
||||||
liveSyncDurationCount: 5, // Balanced for desktop
|
liveSyncDurationCount: 10, // Increased for desktop stability
|
||||||
nudgeOffset: 0.2,
|
nudgeOffset: 0.4,
|
||||||
nudgeMaxRetries: 10,
|
nudgeMaxRetries: 15,
|
||||||
maxLiveSyncPlaybackRate: 1.1,
|
maxLiveSyncPlaybackRate: 1.15,
|
||||||
// Turbo-Start specific
|
// Turbo-Start specific
|
||||||
startLevel: isTurbo ? 0 : -1,
|
startLevel: isTurbo ? 0 : -1,
|
||||||
initialLiveManifestSize: 1,
|
initialLiveManifestSize: 1,
|
||||||
abrEwmaDefaultEstimate: 500000,
|
abrEwmaDefaultEstimate: 500000,
|
||||||
manifestLoadingRetryDelay: 800,
|
manifestLoadingRetryDelay: 1000,
|
||||||
levelLoadingRetryDelay: 800
|
levelLoadingRetryDelay: 1000
|
||||||
});
|
});
|
||||||
window.hlsInstance = hls;
|
window.hlsInstance = hls;
|
||||||
hls.loadSource(url);
|
hls.loadSource(url);
|
||||||
@@ -290,7 +290,11 @@
|
|||||||
log('Trying mpegts.js with: ' + url);
|
log('Trying mpegts.js with: ' + url);
|
||||||
showLoading('Chargement MPEG-TS...');
|
showLoading('Chargement MPEG-TS...');
|
||||||
if (!mpegts.isSupported()) return false;
|
if (!mpegts.isSupported()) return false;
|
||||||
const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, { enableWorker: true, stashInitialSize: 1024 * 1024 });
|
const player = mpegts.createPlayer({ type: 'mpegts', isLive: isLive, url: url }, {
|
||||||
|
enableWorker: true,
|
||||||
|
stashInitialSize: 512 * 1024,
|
||||||
|
maxStashSize: 20 * 1024 * 1024 // 20MB buffer capacity
|
||||||
|
});
|
||||||
player.attachMediaElement(video);
|
player.attachMediaElement(video);
|
||||||
player.load();
|
player.load();
|
||||||
player.play().catch(() => playOverlay.style.display = 'flex');
|
player.play().catch(() => playOverlay.style.display = 'flex');
|
||||||
|
|||||||
+14
-14
@@ -245,22 +245,22 @@
|
|||||||
const isTurbo = urlParams.get('turbo') === 'true';
|
const isTurbo = urlParams.get('turbo') === 'true';
|
||||||
|
|
||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
maxBufferLength: 60, // Increased for stability
|
maxBufferLength: 120, // Doubled for stability
|
||||||
maxMaxBufferLength: 120,
|
maxMaxBufferLength: 240,
|
||||||
enableWorker: true,
|
enableWorker: true,
|
||||||
liveSyncDurationCount: 6, // More distance from live edge (TiviMate style)
|
liveSyncDurationCount: 12, // Increased distance from live edge (TiviMate style) for high latency
|
||||||
liveMaxLatencyDurationCount: 20,
|
liveMaxLatencyDurationCount: 40,
|
||||||
lowLatencyMode: true,
|
lowLatencyMode: false, // Disabled for better stability on laggy connections
|
||||||
// Robustness features
|
// Robustness features
|
||||||
nudgeOffset: 0.2, // Jump over discontinuities
|
nudgeOffset: 0.5, // Jump over discontinuities more aggressively
|
||||||
nudgeMaxRetries: 10,
|
nudgeMaxRetries: 20,
|
||||||
maxLiveSyncPlaybackRate: 1.1, // Smooth catch-up
|
maxLiveSyncPlaybackRate: 1.2, // Smooth catch-up
|
||||||
// Turbo-Start specific
|
// Turbo-Start specific
|
||||||
startLevel: isTurbo ? 0 : -1,
|
startLevel: isTurbo ? 0 : -1,
|
||||||
initialLiveManifestSize: 1,
|
initialLiveManifestSize: 1,
|
||||||
abrEwmaDefaultEstimate: 500000,
|
abrEwmaDefaultEstimate: 500000,
|
||||||
manifestLoadingRetryDelay: 800,
|
manifestLoadingRetryDelay: 1000,
|
||||||
levelLoadingRetryDelay: 800
|
levelLoadingRetryDelay: 1000
|
||||||
});
|
});
|
||||||
|
|
||||||
window.hlsInstance = hls;
|
window.hlsInstance = hls;
|
||||||
@@ -296,14 +296,14 @@
|
|||||||
url: url
|
url: url
|
||||||
}, {
|
}, {
|
||||||
enableWorker: true,
|
enableWorker: true,
|
||||||
stashInitialSize: isTurbo ? 1024 * 1024 : 1024 * 1024, // 1MB Large buffer for everyone
|
stashInitialSize: 512 * 1024,
|
||||||
enableStashBuffer: true,
|
enableStashBuffer: true,
|
||||||
liveBufferLatencyChasing: true,
|
liveBufferLatencyChasing: true,
|
||||||
liveBufferLatencyChasingOnPaused: true,
|
liveBufferLatencyChasingOnPaused: true,
|
||||||
liveBufferLatencyMaxLatency: 3.0, // Safety margin
|
liveBufferLatencyMaxLatency: 10.0,
|
||||||
liveBufferLatencyMinLatency: 1.0,
|
liveBufferLatencyMinLatency: 2.0,
|
||||||
lazyLoad: false,
|
lazyLoad: false,
|
||||||
maxStashSize: 2 * 1024 * 1024 // 2MB Max
|
maxStashSize: 20 * 1024 * 1024
|
||||||
});
|
});
|
||||||
|
|
||||||
player.attachMediaElement(video);
|
player.attachMediaElement(video);
|
||||||
|
|||||||
Reference in new issue
Block a user