invidious-copy-2023-06-08/src/invidious/views/components/player.ecr

51 lines
2.7 KiB
Text
Raw Normal View History

<video style="outline:none;width:100%;background-color:#000" playsinline poster="<%= thumbnail %>"
id="player" class="on-video_player video-js player-style-<%= params.player_style %>"
2019-05-01 04:39:04 +00:00
<% if params.autoplay %>autoplay<% end %>
<% if params.video_loop %>loop<% end %>
<% if params.controls %>controls<% end %>>
2020-06-15 22:33:23 +00:00
<% if (hlsvp = video.hls_manifest_url) && !CONFIG.disabled?("livestreams") %>
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" 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| %>
2020-06-15 22:33:23 +00:00
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' 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" %>
2020-06-15 22:33:23 +00:00
<source src="/api/manifest/dash/id/<%= video.id %>?local=true&unique_res=1" type='application/dash+xml' label="dash">
2018-09-25 00:28:36 +00:00
<% 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 %>
2020-06-15 22:33:23 +00:00
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["quality"] %>" selected="<%= params.quality == fmt["quality"] %>">
<% else %>
2020-06-15 22:33:23 +00:00
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["quality"] %>" selected="<%= i == 0 ? true : false %>">
<% end %>
<% end %>
2019-05-02 01:03:39 +00:00
<% end %>
2021-02-24 06:02:55 +00:00
<% preferred_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 %>"
2021-02-24 06:02:55 +00:00
label="<%= caption.name.simpleText %>">
<% 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 id="player_data" type="application/json">
2020-03-29 21:44:45 +00:00
<%=
{
2020-03-29 21:44:45 +00:00
"aspect_ratio" => aspect_ratio,
"title" => video.title,
"description" => HTML.escape(video.short_description),
2021-02-24 06:02:55 +00:00
"thumbnail" => thumbnail,
"preferred_caption_found" => !preferred_captions.empty?
2020-03-29 21:44:45 +00:00
}.to_pretty_json
%>
</script>
<script src="/js/player.js?v=<%= ASSET_COMMIT %>"></script>