16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/rails_com/active_storage/video_response.rb', line 16
def
file_size = self.response.body.size
match = request.['range'].to_s.match(/bytes=(\d+)-(\d*)/)
match = Array(match)
file_begin = match[1].presence
file_end = match[2].presence
if file_begin && file_end
response.['Content-Range'] = 'bytes ' + file_begin.to_s + '-' + file_end.to_s + '/' + file_size.to_s
response.['Content-Length'] = (file_end.to_i - file_begin.to_i + 1).to_s
response.status = 206
end
end
|