invidious/src/views/watch.ecr
2018-02-26 18:58:45 -06:00

109 lines
3.3 KiB
Text

<% content_for "header" do %>
<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>
<title><%= video.title %> - Invidious</title>
<% end %>
<% if listen %>
<%= render "src/views/player/audio.ecr" %>
<% else %>
<%= render "src/views/player/video.ecr" %>
<% end %>
<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,
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);
}
}
}
});
});
</script>
<h1>
<%= video.info["title"] %>
<% if listen %>
<a class="link" href="/watch?<%= env.params.query %>">
<i class="fa fa-video" aria-hidden="true"></i>
</a>
<% else %>
<a class="link" href="/watch?<%= env.params.query %>&listen=true">
<i class="fa fa-volume-up" aria-hidden="true"></i>
</a>
<% end %>
</h1>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
<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>
<p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
<p id="Engagement">Engagement : <%= engagement.round(2) %>%</p>
</div>
<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>
<div style="margin-right:1em;">
<%= video.description %>
</div>
</div>
<div class="pure-u-1 pure-u-md-1-5">
<% rvs.each do |rv| %>
<% if rv.has_key?("id") %>
<a class="link" href="/watch?v=<%= rv["id"] %>">
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
<%= rv["title"] %>
</a>
<% end %>
<% end %>
</div>
</div>