invidious-copy-2022-08-14/src/views/watch.ecr

122 lines
3.7 KiB
Text
Raw Normal View History

2018-01-07 17:40:03 +00:00
<% content_for "header" do %>
2018-01-21 17:05:30 +00:00
<link rel="stylesheet" href="/css/video-js.css">
<script src="/js/video.js"></script>
<script src="/js/videojs.hotkeys.min.js"></script>
2018-01-28 02:10:08 +00:00
<title><%= video.title %> - Invidious</title>
2018-01-07 17:40:03 +00:00
<% end %>
2018-01-15 03:16:09 +00:00
2018-01-16 20:02:35 +00:00
<% if listen == "true" %>
<audio id="player" class="video-js" data-setup="{}" style="width:100%" controls>
<% adaptive_fmts.each do |fmt| %>
<% url = fmt["url"] %>
<% type = fmt["type"].to_s.split(";")[0] %>
<% if type.starts_with?("audio") %>
<source src="<%= url %>" type="<%= type %>">
2018-01-04 02:06:16 +00:00
<% end %>
<% end %>
2018-01-16 20:02:35 +00:00
</audio>
<% else %>
<video id="player" class="video-js" data-setup="{}" style="width:100%" controls>
<% fmt_stream.each do |fmt| %>
<source src="<%= fmt["url"] %>" type="<%= fmt["type"].split(";")[0] %>">
<% end %>
2018-01-16 19:58:08 +00:00
</video>
2018-01-16 20:02:35 +00:00
<% end %>
2018-01-16 19:58:08 +00:00
<script>
var options = {
poster: "<%= player_response["videoDetails"]["thumbnail"]["thumbnails"][-1]["url"] %>",
aspectRatio: "16:9",
preload: "auto",
playbackRates: [0.5, 1, 1.5, 2]
};
var player = videojs('player', options, function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
2018-02-06 00:36:16 +00:00
enableModifiersForNumbers: false,
enableVolumeScroll: false,
customKeys: {
play: {
key: function(e) {
// Toggle play with K Key
return (e.which === 75);
},
handler: function(player, options, e) {
// Example
if (player.paused()) {
player.play();
} else {
player.pause();
}
}
},
backward: {
key: function(e) {
// Go backward 5 seconds
return (e.which === 74);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() - 5);
}
},
forward: {
key: function(e) {
// Go forward 5 seconds
return (e.which === 76);
},
handler: function(player, options, e) {
player.currentTime(player.currentTime() + 5);
}
}
}
2018-01-16 19:58:08 +00:00
});
});
</script>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<h1>
<%= video.info["title"] %>
<% if listen == "true" %>
2018-01-16 02:30:57 +00:00
<a class="link" href="/watch?<%= env.params.query %>">
2018-01-16 19:58:08 +00:00
<i class="fa fa-video-camera" aria-hidden="true"></i>
</a>
<% else %>
2018-01-16 02:30:57 +00:00
<a class="link" href="/watch?<%= env.params.query %>&listen=true">
2018-01-16 19:58:08 +00:00
<i class="fa fa-volume-up" aria-hidden="true"></i>
</a>
<% end %>
</h1>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
2018-01-28 02:10:08 +00:00
<p><i class="fa fa-eye" aria-hidden="true"></i> <%= video.views %></p>
<p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= video.likes %></p>
<p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= video.dislikes %></p>
<p id="Wilson">Wilson Score : <%= video.wilson_score.round(4) %></p>
2018-01-16 19:58:08 +00:00
<p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
<p id="Engagement">Engagement : <%= engagement.round(2) %>%</p>
</div>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-u-1 pure-u-md-3-5">
<p>
<a class="link" href="https://youtube.com/channel/<%= video.info["ucid"] %>">
<h3><%= video.info["author"] %></h3>
</a>
</p>
<%= description %>
</div>
2018-01-16 02:30:57 +00:00
2018-01-16 19:58:08 +00:00
<div class="pure-u-1 pure-u-md-1-5">
<% rvs.each do |rv| %>
2018-01-15 03:16:09 +00:00
<% if rv.has_key?("id") %>
2018-01-21 17:05:30 +00:00
<a class="link" href="/watch?v=<%= rv["id"] %>">
2018-01-16 20:25:59 +00:00
<img style="width:100%" alt="thumbnail" src="<%= rv["iurlmq"] %>">
</a>
<p>
<a style="display:block; width:100%; height:100%" class="link" href="/watch?v=<%= rv["id"] %>"><%= rv["title"] %></a>
</p>
2018-01-15 03:16:09 +00:00
<% end %>
2018-01-16 19:58:08 +00:00
<% end %>
2018-01-07 17:50:04 +00:00
</div>
2018-01-16 19:58:08 +00:00
</div>