Add redirect for videos with no audio sources
This commit is contained in:
parent
716705aa15
commit
0cf86974dd
1 changed files with 6 additions and 0 deletions
|
@ -419,6 +419,12 @@ get "/watch" 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)
|
||||||
|
|
||||||
|
# Older videos may not have audio sources available.
|
||||||
|
# We redirect here so they're not unplayable
|
||||||
|
if params.listen && audio_streams.empty?
|
||||||
|
next env.redirect "/watch?#{env.params.query}&listen=0"
|
||||||
|
end
|
||||||
|
|
||||||
captions = video.captions
|
captions = video.captions
|
||||||
|
|
||||||
preferred_captions = captions.select { |caption|
|
preferred_captions = captions.select { |caption|
|
||||||
|
|
Loading…
Reference in a new issue