From 841308929dabc773103c7c7479024be544a8a946 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 5 Apr 2018 20:46:32 -0500 Subject: [PATCH] Add &start and &end to watch page --- src/invidious.cr | 6 ++++++ src/views/watch.ecr | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/invidious.cr b/src/invidious.cr index 461f3128..182f6610 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -207,6 +207,12 @@ get "/watch" do |env| next env.redirect "/" end + video_start = env.params.query["start"]?.try &.to_i + video_start ||= 0 + + video_end = env.params.query["end"]?.try &.to_i + video_end ||= -1 + listen = false if env.params.query["listen"]? && env.params.query["listen"] == "true" listen = true diff --git a/src/views/watch.ecr b/src/views/watch.ecr index 8ddbc337..82065397 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -5,6 +5,7 @@ + <%= video.title %> - Invidious <% end %> @@ -74,6 +75,11 @@ var player = videojs('player', options, function() { } }); }); +player.offset({ + start: <%= video_start %>, + end: <%= video_end %>, + restart_beginning: true +}); function toggle(target) { body = target.parentNode.parentNode.children[1];