diff --git a/src/invidious.cr b/src/invidious.cr index ec6c0553..0cf6eb72 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -200,7 +200,7 @@ get "/watch" do |env| end subscriptions ||= [] of String - autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay = process_video_params(env.params.query, preferences) + autoplay, video_loop, video_start, video_end, listen, raw, quality, controls = process_video_params(env.params.query, preferences) if listen env.params.query.delete_all("listen") end @@ -226,6 +226,7 @@ get "/watch" do |env| captions = captions - preferred_captions end preferred_captions ||= [] of Caption + aspect_ratio = "16:9" video.description = fill_links(video.description, "https", "www.youtube.com") video.description = add_alt_links(video.description) @@ -316,7 +317,21 @@ get "/embed/:id" do |env| next env.redirect url end - autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay, controls = process_video_params(env.params.query, nil) + autoplay, video_loop, video_start, video_end, listen, raw, quality, controls = process_video_params(env.params.query, nil) + preferred_captions = [] of Caption + preferences = Preferences.from_json({ + "video_loop" => video_loop, + "autoplay" => autoplay, + "speed" => 1.0, + "quality" => quality, + "volume" => 100, + "max_results" => 0, + "sort" => "", + "latest_only" => false, + "unseen_only" => false, + "dark_mode" => false, + }.to_json) + aspect_ratio = nil begin video = get_video(id, PG_DB) diff --git a/src/invidious/helpers/macros.cr b/src/invidious/helpers/macros.cr index 377b2cab..bcb01c4b 100644 --- a/src/invidious/helpers/macros.cr +++ b/src/invidious/helpers/macros.cr @@ -9,8 +9,8 @@ macro add_mapping(mapping) DB.mapping({{mapping}}) end -macro templated(filename) - render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/layout.ecr" +macro templated(filename, template = "layout") + render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr" end macro rendered(filename) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index faed9b6f..e14f88f4 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -475,7 +475,7 @@ def process_video_params(query, preferences) controls ||= 1 controls = controls == 1 - return autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay, controls + return autoplay, video_loop, video_start, video_end, listen, raw, quality, controls end def generate_thumbnails(json, id) diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr new file mode 100644 index 00000000..30d9f724 --- /dev/null +++ b/src/invidious/views/components/player.ecr @@ -0,0 +1,153 @@ + + + diff --git a/src/invidious/views/components/player_sources.ecr b/src/invidious/views/components/player_sources.ecr new file mode 100644 index 00000000..0132a57f --- /dev/null +++ b/src/invidious/views/components/player_sources.ecr @@ -0,0 +1,12 @@ + + + + + + + + + +<% if hlsvp %> + +<% end %> diff --git a/src/invidious/views/embed.ecr b/src/invidious/views/embed.ecr index b267e512..61dfe0ea 100644 --- a/src/invidious/views/embed.ecr +++ b/src/invidious/views/embed.ecr @@ -2,179 +2,28 @@
- - - - - - - - - - - - - -