Skip to content

Commit

Permalink
Merge pull request #15 from geerew/video-fix
Browse files Browse the repository at this point in the history
Fix video chunking
  • Loading branch information
geerew authored Nov 12, 2024
2 parents fe0a793 + d94ad03 commit 5b67757
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions api/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5b67757

Please sign in to comment.