Speed up /videoplayback streaming
This commit is contained in:
parent
73247d75ca
commit
f189cd7c48
@ -1051,17 +1051,16 @@ get "/videoplayback*" do |env|
|
|||||||
|
|
||||||
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||||
|
|
||||||
chunk = Bytes[8]
|
begin
|
||||||
|
chunk_size = 4096
|
||||||
loop do
|
size = 1
|
||||||
count = response.body_io.read(chunk)
|
while size > 0
|
||||||
|
size = IO.copy(response.body_io, env.response.output, chunk_size)
|
||||||
begin
|
|
||||||
env.response.write(chunk)
|
|
||||||
env.response.flush
|
env.response.flush
|
||||||
rescue ex
|
Fiber.yield
|
||||||
break
|
|
||||||
end
|
end
|
||||||
|
rescue ex
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user