fix: adjust config values

This commit is contained in:
Ante Brähler
2024-11-30 12:07:19 +00:00
parent ea0cc51370
commit 7dd70b4d22
3 changed files with 5 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ function startFFmpeg(channelUrl) {
'-i', channelUrl,
'-c', 'copy',
'-f', 'hls',
'-hls_time', '8',
'-hls_time', '6',
'-hls_list_size', '5',
'-hls_flags', 'delete_segments+program_date_time',
'-start_number', Math.floor(Date.now() / 1000),

View File

@@ -8,7 +8,7 @@ services:
# Set this to the server ip/domain, if your backend is deployed on a different server
#VITE_BACKEND_URL: http://123.123.123.123:5000
VITE_BACKEND_STREAMS_PATH: /streams/playlist.m3u8
VITE_STREAM_DELAY: 20
VITE_STREAM_DELAY: 18
networks:
- app-network

View File

@@ -73,7 +73,7 @@ function VideoPlayer({ channel }: VideoPlayerProps) {
video.play();
});
hls.on(Hls.Events.FRAG_CHANGED, (_event, data) => {
hls.on(Hls.Events.FRAG_LOADED, (_event, data) => {
const now = new Date().getTime();
const newFrag = data.frag;
@@ -81,9 +81,11 @@ function VideoPlayer({ channel }: VideoPlayerProps) {
if(!newFrag.programDateTime) return;
const timeDiff = (now - newFrag.programDateTime) / 1000;
const videoDiff = newFrag.end - video.currentTime;
console.log("Time Diff: ", timeDiff, "Video Diff: ", videoDiff);
const delay = timeDiff + videoDiff;
const targetDelay = import.meta.env.VITE_STREAM_DELAY;
console.log("Delay: ", delay, "Target Delay: ", targetDelay);
const tolerance = 1;
const maxDeviation = 4;