Fix redirect for livestreams

pull/843/head
Omar Roth 5 years ago
parent 8c858a5953
commit 2a04a48b89
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

@ -489,7 +489,7 @@ get "/watch" do |env|
# Older videos may not have audio sources available. # Older videos may not have audio sources available.
# We redirect here so they're not unplayable # We redirect here so they're not unplayable
if audio_streams.empty? if audio_streams.empty? && !video.live_now
if params.quality == "dash" if params.quality == "dash"
env.params.query.delete_all("quality") env.params.query.delete_all("quality")
env.params.query["quality"] = "medium" env.params.query["quality"] = "medium"
@ -729,14 +729,14 @@ get "/embed/:id" do |env|
video_streams = video.video_streams(adaptive_fmts) video_streams = video.video_streams(adaptive_fmts)
audio_streams = video.audio_streams(adaptive_fmts) audio_streams = video.audio_streams(adaptive_fmts)
if audio_streams.empty? if audio_streams.empty? && !video.live_now
if params.quality == "dash" if params.quality == "dash"
env.params.query.delete_all("quality") env.params.query.delete_all("quality")
next env.redirect "/embed/#{video_id}?#{env.params.query}" next env.redirect "/embed/#{id}?#{env.params.query}"
elsif params.listen elsif params.listen
env.params.query.delete_all("listen") env.params.query.delete_all("listen")
env.params.query["listen"] = "0" env.params.query["listen"] = "0"
next env.redirect "/embed/#{video_id}?#{env.params.query}" next env.redirect "/embed/#{id}?#{env.params.query}"
end end
end end

Loading…
Cancel
Save