Merge 9752768d586a4435ef385c0bb083115c05308ffc into 049d591d294e2a43cb32b97a0bb018c2093e5beb

This commit is contained in:
Maarten den Braber 2026-09-05 16:31:01 -07:00 committed by GitHub
commit 0161c82320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,6 +150,26 @@ module Invidious::JSONify::APIv1
json.field "audioSampleRate", fmt["audioSampleRate"].as_s.to_i if fmt.has_key?("audioSampleRate")
json.field "audioChannels", fmt["audioChannels"] if fmt.has_key?("audioChannels")
# Multi-language audio. Only present when a video carries more than
# one audio track. The same data already drives the DASH manifest
# (see `Invidious::Routes::API::Manifest`), but was never exposed on
# the API, leaving clients to scrape `xtags` out of the stream URL.
if audio_track = fmt["audioTrack"]?.try &.as_h?
json.field "audioTrack" do
json.object do
if id = audio_track["id"]?
json.field "id", id
end
if display_name = audio_track["displayName"]?
json.field "displayName", display_name
end
if audio_is_default = audio_track["audioIsDefault"]?
json.field "audioIsDefault", audio_is_default
end
end
end
end
# Extra misc stuff
json.field "colorInfo", fmt["colorInfo"] if fmt.has_key?("colorInfo")
json.field "captionTrack", fmt["captionTrack"] if fmt.has_key?("captionTrack")