mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-06 17:12:45 -05:00
Enable DASH codec selection
This commit is contained in:
parent
821365cf71
commit
29e8d608d3
@ -911,6 +911,18 @@ default_user_preferences:
|
|||||||
##
|
##
|
||||||
#quality_dash: auto
|
#quality_dash: auto
|
||||||
|
|
||||||
|
##
|
||||||
|
## Default dash video codec.
|
||||||
|
##
|
||||||
|
## Note: this setting only takes effect if the
|
||||||
|
## 'quality' parameter is set to "dash".
|
||||||
|
##
|
||||||
|
## Accepted values:
|
||||||
|
## av1, h264
|
||||||
|
## Default: h264
|
||||||
|
##
|
||||||
|
#codec_dash: h264
|
||||||
|
|
||||||
##
|
##
|
||||||
## Default video playback speed.
|
## Default video playback speed.
|
||||||
##
|
##
|
||||||
|
|||||||
@ -96,6 +96,9 @@
|
|||||||
"preferences_quality_dash_option_360p": "360p",
|
"preferences_quality_dash_option_360p": "360p",
|
||||||
"preferences_quality_dash_option_240p": "240p",
|
"preferences_quality_dash_option_240p": "240p",
|
||||||
"preferences_quality_dash_option_144p": "144p",
|
"preferences_quality_dash_option_144p": "144p",
|
||||||
|
"preferences_codec_dash_label": "Preferred DASH video codec: ",
|
||||||
|
"preferences_codec_dash_option_av1": "AV1",
|
||||||
|
"preferences_codec_dash_option_h264": "H.264",
|
||||||
"preferences_volume_label": "Player volume: ",
|
"preferences_volume_label": "Player volume: ",
|
||||||
"preferences_comments_label": "Default comments: ",
|
"preferences_comments_label": "Default comments: ",
|
||||||
"youtube": "YouTube",
|
"youtube": "YouTube",
|
||||||
|
|||||||
@ -37,6 +37,7 @@ struct ConfigPreferences
|
|||||||
property player_style : String = "invidious"
|
property player_style : String = "invidious"
|
||||||
property quality : String = "dash"
|
property quality : String = "dash"
|
||||||
property quality_dash : String = "auto"
|
property quality_dash : String = "auto"
|
||||||
|
property codec_dash : String = "h264"
|
||||||
property default_home : String? = "Popular"
|
property default_home : String? = "Popular"
|
||||||
property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists"]
|
property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists"]
|
||||||
property automatic_instance_redirect : Bool = false
|
property automatic_instance_redirect : Bool = false
|
||||||
|
|||||||
@ -66,6 +66,9 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
quality_dash = env.params.body["quality_dash"]?.try &.as(String)
|
quality_dash = env.params.body["quality_dash"]?.try &.as(String)
|
||||||
quality_dash ||= CONFIG.default_user_preferences.quality_dash
|
quality_dash ||= CONFIG.default_user_preferences.quality_dash
|
||||||
|
|
||||||
|
codec_dash = env.params.body["codec_dash"]?.try &.as(String)
|
||||||
|
codec_dash ||= CONFIG.default_user_preferences.codec_dash
|
||||||
|
|
||||||
volume = env.params.body["volume"]?.try &.as(String).to_i?
|
volume = env.params.body["volume"]?.try &.as(String).to_i?
|
||||||
volume ||= CONFIG.default_user_preferences.volume
|
volume ||= CONFIG.default_user_preferences.volume
|
||||||
|
|
||||||
@ -170,6 +173,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
player_style: player_style,
|
player_style: player_style,
|
||||||
quality: quality,
|
quality: quality,
|
||||||
quality_dash: quality_dash,
|
quality_dash: quality_dash,
|
||||||
|
codec_dash: codec_dash,
|
||||||
default_home: default_home,
|
default_home: default_home,
|
||||||
feed_menu: feed_menu,
|
feed_menu: feed_menu,
|
||||||
automatic_instance_redirect: automatic_instance_redirect,
|
automatic_instance_redirect: automatic_instance_redirect,
|
||||||
|
|||||||
@ -43,6 +43,7 @@ struct Preferences
|
|||||||
property quality : String = CONFIG.default_user_preferences.quality
|
property quality : String = CONFIG.default_user_preferences.quality
|
||||||
@[JSON::Field(converter: Preferences::ProcessString)]
|
@[JSON::Field(converter: Preferences::ProcessString)]
|
||||||
property quality_dash : String = CONFIG.default_user_preferences.quality_dash
|
property quality_dash : String = CONFIG.default_user_preferences.quality_dash
|
||||||
|
property codec_dash : String = CONFIG.default_user_preferences.codec_dash
|
||||||
property default_home : String? = CONFIG.default_user_preferences.default_home
|
property default_home : String? = CONFIG.default_user_preferences.default_home
|
||||||
property feed_menu : Array(String) = CONFIG.default_user_preferences.feed_menu
|
property feed_menu : Array(String) = CONFIG.default_user_preferences.feed_menu
|
||||||
property related_videos : Bool = CONFIG.default_user_preferences.related_videos
|
property related_videos : Bool = CONFIG.default_user_preferences.related_videos
|
||||||
|
|||||||
@ -17,6 +17,7 @@ module Invidious::Videos
|
|||||||
property player_style : String
|
property player_style : String
|
||||||
property quality : String
|
property quality : String
|
||||||
property quality_dash : String
|
property quality_dash : String
|
||||||
|
property codec_dash : String
|
||||||
property raw : Bool
|
property raw : Bool
|
||||||
property region : String?
|
property region : String?
|
||||||
property related_videos : Bool
|
property related_videos : Bool
|
||||||
@ -43,6 +44,7 @@ module Invidious::Videos
|
|||||||
preferred_captions = query["subtitles"]?.try &.split(",").map(&.downcase)
|
preferred_captions = query["subtitles"]?.try &.split(",").map(&.downcase)
|
||||||
quality = query["quality"]?
|
quality = query["quality"]?
|
||||||
quality_dash = query["quality_dash"]?
|
quality_dash = query["quality_dash"]?
|
||||||
|
codec_dash = query["codec_dash"]?
|
||||||
region = query["region"]?
|
region = query["region"]?
|
||||||
related_videos = query["related_videos"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
related_videos = query["related_videos"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
speed = query["speed"]?.try &.rchop("x").to_f?
|
speed = query["speed"]?.try &.rchop("x").to_f?
|
||||||
@ -66,6 +68,7 @@ module Invidious::Videos
|
|||||||
preferred_captions ||= preferences.captions
|
preferred_captions ||= preferences.captions
|
||||||
quality ||= preferences.quality
|
quality ||= preferences.quality
|
||||||
quality_dash ||= preferences.quality_dash
|
quality_dash ||= preferences.quality_dash
|
||||||
|
codec_dash ||= preferences.codec_dash
|
||||||
related_videos ||= preferences.related_videos.to_unsafe
|
related_videos ||= preferences.related_videos.to_unsafe
|
||||||
speed ||= preferences.speed
|
speed ||= preferences.speed
|
||||||
video_loop ||= preferences.video_loop.to_unsafe
|
video_loop ||= preferences.video_loop.to_unsafe
|
||||||
@ -87,6 +90,7 @@ module Invidious::Videos
|
|||||||
preferred_captions ||= CONFIG.default_user_preferences.captions
|
preferred_captions ||= CONFIG.default_user_preferences.captions
|
||||||
quality ||= CONFIG.default_user_preferences.quality
|
quality ||= CONFIG.default_user_preferences.quality
|
||||||
quality_dash ||= CONFIG.default_user_preferences.quality_dash
|
quality_dash ||= CONFIG.default_user_preferences.quality_dash
|
||||||
|
codec_dash ||= CONFIG.default_user_preferences.codec_dash
|
||||||
related_videos ||= CONFIG.default_user_preferences.related_videos.to_unsafe
|
related_videos ||= CONFIG.default_user_preferences.related_videos.to_unsafe
|
||||||
speed ||= CONFIG.default_user_preferences.speed
|
speed ||= CONFIG.default_user_preferences.speed
|
||||||
video_loop ||= CONFIG.default_user_preferences.video_loop.to_unsafe
|
video_loop ||= CONFIG.default_user_preferences.video_loop.to_unsafe
|
||||||
@ -148,6 +152,7 @@ module Invidious::Videos
|
|||||||
preferred_captions: preferred_captions,
|
preferred_captions: preferred_captions,
|
||||||
quality: quality,
|
quality: quality,
|
||||||
quality_dash: quality_dash,
|
quality_dash: quality_dash,
|
||||||
|
codec_dash: codec_dash,
|
||||||
raw: raw,
|
raw: raw,
|
||||||
region: region,
|
region: region,
|
||||||
related_videos: related_videos,
|
related_videos: related_videos,
|
||||||
|
|||||||
@ -42,6 +42,7 @@
|
|||||||
<% if params.quality == "dash"
|
<% if params.quality == "dash"
|
||||||
src_url = "/api/manifest/dash/id/" + video.id + "?local=true&unique_res=1"
|
src_url = "/api/manifest/dash/id/" + video.id + "?local=true&unique_res=1"
|
||||||
src_url = invidious_companion.public_url.to_s + src_url +
|
src_url = invidious_companion.public_url.to_s + src_url +
|
||||||
|
"&codec_dash=#{params.codec_dash}" +
|
||||||
"&check=#{invidious_companion_check_id}" if (invidious_companion)
|
"&check=#{invidious_companion_check_id}" if (invidious_companion)
|
||||||
%>
|
%>
|
||||||
<source src="<%= src_url %>" type='application/dash+xml' label="dash">
|
<source src="<%= src_url %>" type='application/dash+xml' label="dash">
|
||||||
|
|||||||
@ -73,6 +73,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if !CONFIG.disabled?("dash") %>
|
||||||
|
<div class="pure-control-group">
|
||||||
|
<label for="codec_dash"><%= I18n.translate(locale, "preferences_codec_dash_label") %></label>
|
||||||
|
<select name="codec_dash" id="codec_dash">
|
||||||
|
<% {"av1", "h264"}.each do |option| %>
|
||||||
|
<option value="<%= option %>" <% if preferences.codec_dash == option %> selected <% end %>><%= I18n.translate(locale, "preferences_codec_dash_option_" + option) %></option>
|
||||||
|
<% end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="volume"><%= I18n.translate(locale, "preferences_volume_label") %></label>
|
<label for="volume"><%= I18n.translate(locale, "preferences_volume_label") %></label>
|
||||||
<input name="volume" id="volume" data-onrange="update_volume_value" type="range" min="0" max="100" step="5" value="<%= preferences.volume %>">
|
<input name="volume" id="volume" data-onrange="update_volume_value" type="range" min="0" max="100" step="5" value="<%= preferences.volume %>">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user