forked from midou/invidious
Merge pull request #8 from omarroth/embed-options
Add 'autoplay', 'controls', 'loop' to embedded player options
This commit is contained in:
commit
e87c6186e7
@ -400,6 +400,15 @@ get "/embed/:id" do |env|
|
|||||||
end
|
end
|
||||||
listen ||= false
|
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)
|
client = make_client(YT_URL)
|
||||||
begin
|
begin
|
||||||
video = get_video(id, client, PG_DB)
|
video = get_video(id, client, PG_DB)
|
||||||
|
@ -29,7 +29,7 @@ video, #my_video, .video-js, .vjs-default-skin
|
|||||||
}
|
}
|
||||||
</style>
|
</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 %>
|
<% if listen %>
|
||||||
<% audio_streams.each_with_index do |fmt, i| %>
|
<% audio_streams.each_with_index do |fmt, i| %>
|
||||||
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
<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>
|
<script>
|
||||||
var options = {
|
var options = {
|
||||||
preload: "auto",
|
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],
|
playbackRates: [0.5, 1, 1.5, 2],
|
||||||
controlBar: {
|
controlBar: {
|
||||||
children: [
|
children: [
|
||||||
|
Loading…
Reference in New Issue
Block a user