summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
author138138138 <78271024+138138138@users.noreply.github.com>2022-06-24 17:26:30 +0800
committerGitHub <noreply@github.com>2022-06-24 17:26:30 +0800
commitc75bf35f59864c9f7e37816d657e913f29b40123 (patch)
tree69b1677e3fb7ff3a1a91e43abdc1d3fb25d8ae06 /src
parent3013782b7b39295b34c3f5a72274efc625748a7f (diff)
downloadinvidious-c75bf35f59864c9f7e37816d657e913f29b40123.tar.gz
invidious-c75bf35f59864c9f7e37816d657e913f29b40123.tar.bz2
invidious-c75bf35f59864c9f7e37816d657e913f29b40123.zip
Update DASH format to serve 2 audio to player
player.audioTracks() can successfully show tracks_: Array(2)
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/api/manifest.cr20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr
index b8466df1..476ff65a 100644
--- a/src/invidious/routes/api/manifest.cr
+++ b/src/invidious/routes/api/manifest.cr
@@ -46,7 +46,7 @@ module Invidious::Routes::API::Manifest
end
end
- audio_streams = video.audio_streams
+ audio_streams = video.audio_streams.sort_by { |stream| {stream["bitrate"].as_i} }.reverse!
video_streams = video.video_streams.sort_by { |stream| {stream["width"].as_i, stream["fps"].as_i} }.reverse!
manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml|
@@ -60,19 +60,8 @@ module Invidious::Routes::API::Manifest
mime_streams = audio_streams.select { |stream| stream["mimeType"].as_s.starts_with? mime_type }
next if mime_streams.empty?
- xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do
- # ignore the 64k m4a stream, only consider the 128k m4a stream
- best_m4a_stream = mime_streams[0]
- best_m4a_stream_bitrate = 0
- mime_streams.each do |fmt|
- bandwidth = fmt["bitrate"].as_i
- if (bandwidth > best_m4a_stream_bitrate)
- best_m4a_stream_bitrate = bandwidth
- best_m4a_stream = fmt
- end
- end
-
- [best_m4a_stream].each do |fmt|
+ mime_streams.each do |fmt|
+ xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, lang: i.to_s) do
# OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415)
next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange"))
@@ -90,9 +79,8 @@ module Invidious::Routes::API::Manifest
end
end
end
+ i += 1
end
-
- i += 1
end
potential_heights = {4320, 2160, 1440, 1080, 720, 480, 360, 240, 144}