diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-16 08:08:18 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-16 08:08:18 -0500 |
| commit | 23711a127c7194c4a83ee54b803ce72fca141280 (patch) | |
| tree | b5d34a40d87e8fdbe808ee89da18d048892e3d32 /src | |
| parent | f189cd7c480d1c48a004042295d3fa1b4d0bddc3 (diff) | |
| download | invidious-23711a127c7194c4a83ee54b803ce72fca141280.tar.gz invidious-23711a127c7194c4a83ee54b803ce72fca141280.tar.bz2 invidious-23711a127c7194c4a83ee54b803ce72fca141280.zip | |
Add 'autoplay', 'controls', 'loop' to embedded player options
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 9 | ||||
| -rw-r--r-- | src/invidious/views/embed.ecr | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 01759a62..6c36f87a 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -400,6 +400,15 @@ get "/embed/:id" do |env| end listen ||= false + autoplay = env.params.query["autoplay"]?.try &.to_i + autoplay ||= 0 + + controls = env.params.query["controls"]?.try &.to_i + controls ||= 1 + + video_loop = env.params.query["loop"]?.try &.to_i + video_loop ||= 0 + client = make_client(YT_URL) begin video = get_video(id, client, PG_DB) diff --git a/src/invidious/views/embed.ecr b/src/invidious/views/embed.ecr index 38eb5155..e9c09402 100644 --- a/src/invidious/views/embed.ecr +++ b/src/invidious/views/embed.ecr @@ -29,7 +29,7 @@ video, #my_video, .video-js, .vjs-default-skin } </style> -<video playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>" id="player" class="video-js vjs-default-skin" controls> +<video playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>" id="player" class="video-js vjs-default-skin"> <% if listen %> <% audio_streams.each_with_index do |fmt, i| %> <source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>"> @@ -44,6 +44,9 @@ video, #my_video, .video-js, .vjs-default-skin <script> var options = { preload: "auto", + <% if autoplay == 1 %>autoplay: true, <% end %> + <% if controls == 1 %>controls: true, <% end %> + <% if video_loop == 1 %>loop: true, <% end %> playbackRates: [0.5, 1, 1.5, 2], controlBar: { children: [ |
