Fix redirect for livestreams

This commit is contained in:
Omar Roth 2019-10-20 12:48:11 -04:00
parent 8c858a5953
commit 2a04a48b89
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

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