我正在尝试将视频上传到Wistia。他们有一个例子:
require 'net/http'
require 'net/http/post/multipart'
def post_video_to_wistia(name, path_to_video)
uri = URI('https://upload.wistia.com/')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Construct the request.
request = Net::HTTP::Post::Multipart.new uri.request_uri, {
'api_password' => '<API_PASSWORD>',
'contact_id' => '<CONTACT_ID>', # Optional.
'project_id' => '<PROJECT_ID>', # Optional.
'name' => '<MEDIA_NAME>', # Optional.
'file' => UploadIO.new(
File.open(path_to_video),
'application/octet-stream',
File.basename(path_to_video)
)
}
# Make it so!
response = http.request(request)
return response
end
一切都很好。但是我如何使用流媒体响应机构构建上传流程的进度条呢?