Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/invidious/jsonify/api_v1/video_json.cr
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,23 @@ 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"]?
json.field "audioTrack" do
json.object do
# Language tag with a track discriminator, e.g. "en-US.4".
json.field "id", audio_track["id"] if audio_track["id"]?
# Human-readable label, e.g. "English (original)".
json.field "displayName", audio_track["displayName"] if audio_track["displayName"]?
# True for the video's original (undubbed) audio.
json.field "audioIsDefault", audio_track["audioIsDefault"] if audio_track["audioIsDefault"]?
end
end
end
Comment thread
mdbraber marked this conversation as resolved.
Outdated

# Extra misc stuff
json.field "colorInfo", fmt["colorInfo"] if fmt.has_key?("colorInfo")
json.field "captionTrack", fmt["captionTrack"] if fmt.has_key?("captionTrack")
Expand Down
Loading