2020-09-15 17:50:17 +00:00
|
|
|
<video style="outline:none;width:100%;background-color:#000" playsinline poster="<%= thumbnail %>"
|
2020-03-15 21:46:08 +00:00
|
|
|
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") %>
|
2021-01-31 18:52:32 +00:00
|
|
|
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
|
2018-08-11 15:52:13 +00:00
|
|
|
<% else %>
|
2019-05-01 04:39:04 +00:00
|
|
|
<% if params.listen %>
|
2018-08-11 15:52:13 +00:00
|
|
|
<% 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 %>">
|
2018-08-11 15:52:13 +00:00
|
|
|
<% end %>
|
2021-07-15 21:01:36 +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
|
|
|
|
2021-07-15 21:01:36 +00:00
|
|
|
<%
|
2021-09-03 07:39:11 +00:00
|
|
|
fmt_stream.reject! { |f| f["itag"] == 17 }
|
|
|
|
fmt_stream.sort_by! {|f| params.quality == f["quality"] ? 0 : 1 }
|
2021-07-15 21:01:36 +00:00
|
|
|
fmt_stream.each_with_index do |fmt, i|
|
|
|
|
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
|
|
|
|
src_url += "&local=true" if params.local
|
|
|
|
|
|
|
|
quality = fmt["quality"]
|
2021-09-13 16:20:11 +00:00
|
|
|
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
2021-07-15 21:01:36 +00:00
|
|
|
|
|
|
|
selected = params.quality ? (params.quality == quality) : (i == 0)
|
|
|
|
%>
|
|
|
|
<source src="<%= src_url %>" type="<%= mimetype %>" label="<%= quality %>" selected="<%= selected %>">
|
2018-08-11 15:52:13 +00:00
|
|
|
<% end %>
|
2019-05-02 01:03:39 +00:00
|
|
|
<% end %>
|
2018-08-11 15:52:13 +00:00
|
|
|
|
2021-02-24 06:02:55 +00:00
|
|
|
<% preferred_captions.each do |caption| %>
|
2021-11-10 15:42:37 +00:00
|
|
|
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
|
2018-08-11 15:52:13 +00:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% captions.each do |caption| %>
|
2021-11-10 15:42:37 +00:00
|
|
|
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
|
2018-08-11 15:52:13 +00:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2018-12-09 02:12:22 +00:00
|
|
|
</video>
|
2018-08-11 15:52:13 +00:00
|
|
|
|
2020-03-15 21:46:08 +00:00
|
|
|
<script id="player_data" type="application/json">
|
2020-03-29 21:44:45 +00:00
|
|
|
<%=
|
2020-03-15 21:46:08 +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
|
|
|
|
%>
|
2018-08-11 15:52:13 +00:00
|
|
|
</script>
|
2019-05-09 16:52:37 +00:00
|
|
|
<script src="/js/player.js?v=<%= ASSET_COMMIT %>"></script>
|