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];