Videos: Fix audio tracks language.
All checks were successful
Invidious CI / build (push) Successful in 5m51s

Video will only return the default language. The rest of the audio
tracks are deleted since they will not be used.
This commit is contained in:
Fijxu 2024-10-30 13:14:54 -03:00
parent ab696010f1
commit 7b662b008c
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
2 changed files with 10 additions and 0 deletions

View file

@ -55,6 +55,10 @@ module Invidious::Routes::API::Manifest
end
end
audio_streams.reject! do |z|
z if z["audioTrack"]["audioIsDefault"].as_bool == false
end
manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml|
xml.element("MPD", "xmlns": "urn:mpeg:dash:schema:mpd:2011",
"profiles": "urn:mpeg:dash:profile:full:2011", minBufferTime: "PT1.5S", type: "static",

View file

@ -152,6 +152,12 @@ module Invidious::Routes::Watch
end
end
audio_streams.reject! do |z|
z if z["audioTrack"]["audioIsDefault"].as_bool == false
end
pp audio_streams
# Older videos may not have audio sources available.
# We redirect here so they're not unplayable
if audio_streams.empty? && !video.live_now