From d94ad03bb7e73f481521c05e135bd93bc47ec690 Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Tue, 12 Nov 2024 10:41:11 +0000 Subject: [PATCH] Fix video chunking --- api/assets.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/assets.go b/api/assets.go index 0f9a3ec..557e465 100644 --- a/api/assets.go +++ b/api/assets.go @@ -242,14 +242,15 @@ func handleVideo(c *fiber.Ctx, appFs *appFs.AppFs, asset *models.Asset) error { rangeStartEnd := strings.Split(bytesPos, "-") start, _ := strconv.Atoi(rangeStartEnd[0]) var end int - if rangeStartEnd[1] == "" { - // Calculate the initial chunk end based on maxInitialChunkSize + + if len(rangeStartEnd) == 2 && rangeStartEnd[0] == "0" && rangeStartEnd[1] == "1" { + start = 0 + end = 1 + } else { end = start + maxInitialChunkSize - 1 if end >= int(fileInfo.Size()) { end = int(fileInfo.Size()) - 1 } - } else { - end, _ = strconv.Atoi(rangeStartEnd[1]) } if start > end {