invidious-mod-JP/src/invidious/views/components/player.ecr

51 lines
2.8 KiB
Plaintext
Raw Normal View History

<video style="outline:none;width:100%;background-color:#000" playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>"
id="player" class="video-js player-style-<%= params.player_style %>"
2018-11-26 01:01:04 +00:00
onmouseenter='this["data-title"]=this["title"];this["title"]=""'
onmouseleave='this["title"]=this["data-title"];this["data-title"]=""'
oncontextmenu='this["title"]=this["data-title"]'
2019-05-01 04:39:04 +00:00
<% if params.autoplay %>autoplay<% end %>
<% if params.video_loop %>loop<% end %>
<% if params.controls %>controls<% end %>>
<% if hlsvp && !CONFIG.disabled?("livestreams") %>
2019-04-25 17:41:35 +00:00
<source src="<%= hlsvp %>?local=true" type="application/x-mpegURL" label="livestream">
<% else %>
2019-05-01 04:39:04 +00:00
<% if params.listen %>
<% audio_streams.each_with_index do |fmt, i| %>
2019-05-01 04:39:04 +00:00
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %>
2019-03-23 18:31:07 +00:00
<% else %>
2019-05-01 04:39:04 +00:00
<% if params.quality == "dash" %>
2018-09-25 00:28:36 +00:00
<source src="/api/manifest/dash/id/<%= video.id %>?local=true" type='application/dash+xml' label="dash">
<% end %>
2019-03-23 18:31:07 +00:00
<% fmt_stream.each_with_index do |fmt, i| %>
2019-05-01 04:39:04 +00:00
<% if params.quality %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params.quality == fmt["label"].split(" - ")[0] %>">
<% else %>
2019-05-01 04:39:04 +00:00
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<% end %>
<% end %>
2019-05-02 01:03:39 +00:00
<% end %>
<% preferred_captions.each_with_index do |caption, i| %>
2019-05-02 01:03:39 +00:00
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name.simpleText %>&hl=<%= env.get("preferences").as(Preferences).locale %>"
label="<%= caption.name.simpleText %>" <% if i == 0 %>default<% end %>>
<% end %>
<% captions.each do |caption| %>
2019-05-02 01:03:39 +00:00
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name.simpleText %>&hl=<%= env.get("preferences").as(Preferences).locale %>"
label="<%= caption.name.simpleText %>">
<% end %>
<% end %>
</video>
<script>
2019-05-06 16:23:14 +00:00
var player_data = {
aspect_ratio: '<%= aspect_ratio %>',
2019-05-02 01:03:39 +00:00
title: "<%= video.title.dump_unquoted %>",
2019-06-08 20:08:27 +00:00
description: "<%= HTML.escape(video.short_description) %>",
2019-05-06 16:23:14 +00:00
thumbnail: "<%= thumbnail %>"
2018-11-28 03:18:20 +00:00
}
</script>
<script src="/js/player.js?v=<%= ASSET_COMMIT %>"></script>