Skip to content

Commit

Permalink
Better fix for safari video bug
Browse files Browse the repository at this point in the history
This seems to work everywhere that I've tested.
  • Loading branch information
crisward committed Sep 28, 2017
1 parent 81f2ee7 commit 6c11f94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kemal/helpers/helpers.cr
Expand Up @@ -149,14 +149,14 @@ private def multipart(file, env : HTTP::Server::Context)
end

if endb == 0
endb = fileb
endb = fileb - 1
end

if startb < endb && endb <= fileb
env.response.status_code = 206
env.response.content_length = endb - startb
env.response.headers["Accept-Ranges"] = "bytes"
env.response.headers["Content-Range"] = "bytes #{startb}-#{endb > 1 ? endb - 1 : 1}/#{fileb}" # MUST
env.response.headers["Content-Range"] = "bytes #{startb}-#{endb}/#{fileb}" # MUST

if startb > 1024
skipped = 0
Expand Down

0 comments on commit 6c11f94

Please sign in to comment.