Add player title and thumbnail

このコミットが含まれているのは:
Omar Roth 2018-03-07 16:48:26 -06:00
コミット 24fc14ac7a
4個のファイルの変更8行の追加8行の削除

ファイルの表示

@ -229,6 +229,8 @@ get "/watch" do |env|
video.description = fill_links(video.description, "https", "www.youtube.com")
video.description = add_alt_links(video.description)
thumbnail = player_response["videoDetails"]["thumbnail"]["thumbnails"][-1]["url"]?
templated "watch"
end

ファイルの表示

@ -1,9 +1,7 @@
<audio id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<audio poster="<%= thumbnail %>" title="<%= video.title%>" id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% adaptive_fmts.each do |fmt| %>
<% url = fmt["url"]? %>
<% type = fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>
<% if type.starts_with?("audio") %>
<source src="<%= url %>" type="<%= type %>">
<% if fmt["type"].starts_with?("audio") %>
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>'>
<% end %>
<% end %>
</audio>

ファイルの表示

@ -1,5 +1,5 @@
<video id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<video poster="<%= thumbnail %>" title="<%= video.title%>" id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% fmt_stream.each do |fmt| %>
<source src="<%= fmt["url"]? %>" type="<%= fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>">
<source src="<%= fmt["url"]? %>" type='<%= fmt["type"]? %>'>
<% end %>
</video>

ファイルの表示

@ -1,4 +1,5 @@
<% content_for "header" do %>
<meta name="thumbnail" content="<%= thumbnail %>">
<link rel="stylesheet" href="http://vjs.zencdn.net/6.6.3/video-js.css">
<script src="http://vjs.zencdn.net/6.6.3/video.js"></script>
<script src="//cdn.sc.gl/videojs-hotkeys/latest/videojs.hotkeys.min.js"></script>
@ -13,7 +14,6 @@
<script>
var options = {
poster: "<%= player_response["videoDetails"]["thumbnail"]["thumbnails"][-1]["url"]? %>",
aspectRatio: "16:9",
preload: "auto",
playbackRates: [0.5, 1, 1.5, 2]