summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-03-07 16:48:26 -0600
committerOmar Roth <omarroth@hotmail.com>2018-03-07 16:48:26 -0600
commit24fc14ac7a9cfaf352afd9cc6ba4a2856af78a9a (patch)
treec963679fe9796019e0c6471a1f7185ae88444b93 /src
parent212ba0504795da802b42083c8be469dc7ce326e3 (diff)
downloadinvidious-24fc14ac7a9cfaf352afd9cc6ba4a2856af78a9a.tar.gz
invidious-24fc14ac7a9cfaf352afd9cc6ba4a2856af78a9a.tar.bz2
invidious-24fc14ac7a9cfaf352afd9cc6ba4a2856af78a9a.zip
Add player title and thumbnail
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr2
-rw-r--r--src/views/player/audio.ecr8
-rw-r--r--src/views/player/video.ecr4
-rw-r--r--src/views/watch.ecr2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 4b3cdd64..0dd46f55 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -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
diff --git a/src/views/player/audio.ecr b/src/views/player/audio.ecr
index 0bed59ae..1122d8d0 100644
--- a/src/views/player/audio.ecr
+++ b/src/views/player/audio.ecr
@@ -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> \ No newline at end of file
diff --git a/src/views/player/video.ecr b/src/views/player/video.ecr
index ebc5df15..8e17711f 100644
--- a/src/views/player/video.ecr
+++ b/src/views/player/video.ecr
@@ -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> \ No newline at end of file
diff --git a/src/views/watch.ecr b/src/views/watch.ecr
index 85553123..44fc4257 100644
--- a/src/views/watch.ecr
+++ b/src/views/watch.ecr
@@ -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]