2018-01-07 23:10:03 +05:30
|
|
|
<% content_for "header" do %>
|
2018-03-08 04:18:26 +05:30
|
|
|
<meta name="thumbnail" content="<%= thumbnail %>">
|
2018-07-09 22:47:57 +05:30
|
|
|
<link rel="stylesheet" href="https://unpkg.com/video.js@6.10.3/dist/video-js.min.css">
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/silvermine-videojs-quality-selector@1.1.2/dist/css/quality-selector.css">
|
|
|
|
<script src="https://unpkg.com/video.js@6.10.3/dist/video.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/videojs-hotkeys@0.2.21/videojs.hotkeys.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/silvermine-videojs-quality-selector@1.1.2/dist/js/silvermine-videojs-quality-selector.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/videojs-offset@2.0.0-beta.2/dist/videojs-offset.min.js"></script>
|
2018-01-28 07:40:08 +05:30
|
|
|
<title><%= video.title %> - Invidious</title>
|
2018-01-07 23:10:03 +05:30
|
|
|
<% end %>
|
2018-01-15 08:46:09 +05:30
|
|
|
|
2018-03-13 05:07:01 +05:30
|
|
|
<div class="h-box">
|
2018-07-19 21:00:54 +05:30
|
|
|
<video style="width:100%" playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>"
|
|
|
|
id="player" class="video-js vjs-16-9" data-setup="{}"
|
2018-07-21 01:44:15 +05:30
|
|
|
<% if autoplay %>autoplay<% end %>
|
|
|
|
<% if video_loop %>loop<% end %>
|
2018-07-19 21:00:54 +05:30
|
|
|
controls>
|
2018-06-09 01:08:59 +05:30
|
|
|
<% if listen %>
|
|
|
|
<% audio_streams.each_with_index do |fmt, i| %>
|
|
|
|
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<% fmt_stream.each_with_index do |fmt, i| %>
|
2018-07-16 21:54:24 +05:30
|
|
|
<% if preferences %>
|
|
|
|
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= preferences.quality == fmt["label"].split(" - ")[0] %>">
|
|
|
|
<% else %>
|
2018-06-09 01:08:59 +05:30
|
|
|
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
|
2018-07-16 21:54:24 +05:30
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2018-06-09 01:08:59 +05:30
|
|
|
<% end %>
|
|
|
|
</video>
|
2018-03-11 22:35:56 +05:30
|
|
|
</div>
|
2018-01-17 01:28:08 +05:30
|
|
|
|
|
|
|
<script>
|
|
|
|
var options = {
|
|
|
|
preload: "auto",
|
2018-03-14 05:07:56 +05:30
|
|
|
playbackRates: [0.5, 1, 1.5, 2],
|
|
|
|
controlBar: {
|
|
|
|
children: [
|
|
|
|
'playToggle',
|
|
|
|
'volumePanel',
|
|
|
|
'progressControl',
|
|
|
|
'remainingTimeDisplay',
|
|
|
|
'qualitySelector',
|
|
|
|
'playbackRateMenuButton',
|
|
|
|
'fullscreenToggle',
|
|
|
|
],
|
|
|
|
},
|
2018-01-17 01:28:08 +05:30
|
|
|
};
|
2018-07-21 01:20:55 +05:30
|
|
|
|
2018-01-17 01:28:08 +05:30
|
|
|
var player = videojs('player', options, function() {
|
|
|
|
this.hotkeys({
|
|
|
|
volumeStep: 0.1,
|
|
|
|
seekStep: 5,
|
2018-02-06 06:06:16 +05:30
|
|
|
enableModifiersForNumbers: false,
|
|
|
|
enableVolumeScroll: false,
|
|
|
|
customKeys: {
|
|
|
|
play: {
|
|
|
|
key: function(e) {
|
|
|
|
// Toggle play with K Key
|
|
|
|
return (e.which === 75);
|
|
|
|
},
|
|
|
|
handler: function(player, options, e) {
|
|
|
|
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-17 01:28:08 +05:30
|
|
|
});
|
|
|
|
});
|
2018-05-08 07:08:13 +05:30
|
|
|
|
2018-07-16 21:54:24 +05:30
|
|
|
<% if preferences %>
|
|
|
|
player.volume(<%= preferences.volume.to_f / 100 %>);
|
2018-07-16 22:27:52 +05:30
|
|
|
player.playbackRate(<%= preferences.speed %>);
|
2018-07-16 21:54:24 +05:30
|
|
|
<% end %>
|
2018-04-06 07:16:32 +05:30
|
|
|
player.offset({
|
|
|
|
start: <%= video_start %>,
|
2018-05-08 07:08:13 +05:30
|
|
|
end: <%= video_end %>
|
2018-04-06 07:16:32 +05:30
|
|
|
});
|
2018-03-04 02:36:14 +05:30
|
|
|
|
2018-03-04 10:06:18 +05:30
|
|
|
function toggle(target) {
|
|
|
|
body = target.parentNode.parentNode.children[1];
|
|
|
|
if (body.style.display === null || body.style.display === '') {
|
|
|
|
target.innerHTML = '[ + ]';
|
|
|
|
body.style.display = 'none';
|
|
|
|
} else {
|
|
|
|
target.innerHTML = '[ - ]';
|
|
|
|
body.style.display = '';
|
|
|
|
}
|
2018-03-13 05:06:08 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
function toggle_comments(target) {
|
|
|
|
body = target.parentNode.parentNode.parentNode.children[1];
|
|
|
|
if (body.style.display === null || body.style.display === '') {
|
|
|
|
target.innerHTML = '[ + ]';
|
|
|
|
body.style.display = 'none';
|
|
|
|
} else {
|
|
|
|
target.innerHTML = '[ - ]';
|
|
|
|
body.style.display = '';
|
2018-03-14 05:07:56 +05:30
|
|
|
}
|
2018-03-13 05:06:08 +05:30
|
|
|
};
|
2018-04-11 08:19:10 +05:30
|
|
|
|
2018-04-12 03:54:50 +05:30
|
|
|
<% if !listen %>
|
2018-04-11 08:19:10 +05:30
|
|
|
var currentSources = player.currentSources();
|
|
|
|
for ( var i = 0; i < currentSources.length; i++ ) {
|
|
|
|
if (player.canPlayType(currentSources[i]["type"].split(";")[0]) === "") {
|
|
|
|
currentSources.splice(i);
|
2018-04-11 08:24:23 +05:30
|
|
|
i--;
|
2018-04-11 08:19:10 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
player.src(currentSources);
|
2018-04-12 03:54:50 +05:30
|
|
|
<% end %>
|
2018-07-21 01:06:23 +05:30
|
|
|
|
|
|
|
fetch("/comments/<%= video.id %>?source=reddit")
|
|
|
|
.then(function(response) {
|
|
|
|
return response.json();
|
|
|
|
})
|
|
|
|
.then(function(jsonResponse) {
|
|
|
|
comments = document.getElementById('comments');
|
|
|
|
comments.innerHTML = `
|
|
|
|
<div>
|
|
|
|
<h3>
|
|
|
|
<a href="javascript:void(0)" onclick="toggle_comments(this)">[ - ]</a>
|
|
|
|
{title}
|
|
|
|
</h3>
|
|
|
|
<b>
|
|
|
|
<a target="_blank" href="https://reddit.com{permalink}">View more comments on Reddit</a>
|
|
|
|
</b>
|
|
|
|
</div>
|
|
|
|
<div>{content_html}</div>
|
|
|
|
</div>
|
|
|
|
<hr style="margin-left:1em; margin-right:1em;">`.supplant({
|
|
|
|
title: jsonResponse.title,
|
|
|
|
permalink: jsonResponse.permalink,
|
|
|
|
content_html: jsonResponse.content_html
|
|
|
|
})
|
2018-07-21 01:20:55 +05:30
|
|
|
}, function(response){
|
|
|
|
comments.innerHTML = "";
|
2018-07-21 01:06:23 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
String.prototype.supplant = function (o) {
|
|
|
|
return this.replace(/{([^{}]*)}/g,
|
|
|
|
function (a, b) {
|
|
|
|
var r = o[b];
|
|
|
|
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2018-01-17 01:28:08 +05:30
|
|
|
</script>
|
2018-01-16 08:00:57 +05:30
|
|
|
|
2018-03-13 05:07:01 +05:30
|
|
|
<div class="h-box">
|
2018-01-17 01:28:08 +05:30
|
|
|
<h1>
|
2018-06-03 08:45:15 +05:30
|
|
|
<%= video.title %>
|
2018-02-12 04:31:32 +05:30
|
|
|
<% if listen %>
|
2018-03-07 09:33:45 +05:30
|
|
|
<a href="/watch?<%= env.params.query %>">
|
2018-02-12 04:31:32 +05:30
|
|
|
<i class="fa fa-video" aria-hidden="true"></i>
|
2018-01-17 01:28:08 +05:30
|
|
|
</a>
|
|
|
|
<% else %>
|
2018-03-07 09:33:45 +05:30
|
|
|
<a href="/watch?<%= env.params.query %>&listen=true">
|
2018-01-17 01:28:08 +05:30
|
|
|
<i class="fa fa-volume-up" aria-hidden="true"></i>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</h1>
|
2018-03-11 22:35:56 +05:30
|
|
|
</div>
|
2018-01-16 08:00:57 +05:30
|
|
|
|
2018-01-17 01:28:08 +05:30
|
|
|
<div class="pure-g">
|
|
|
|
<div class="pure-u-1 pure-u-md-1-5">
|
2018-04-18 02:23:12 +05:30
|
|
|
<div class="h-box">
|
2018-03-16 22:44:40 +05:30
|
|
|
<p><i class="fa fa-eye" aria-hidden="true"></i> <%= number_with_separator(video.views) %></p>
|
|
|
|
<p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= number_with_separator(video.likes) %></p>
|
|
|
|
<p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= number_with_separator(video.dislikes) %></p>
|
2018-04-01 08:44:33 +05:30
|
|
|
<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>
|
2018-04-08 06:39:20 +05:30
|
|
|
<% if ad_slots %>
|
2018-04-11 07:39:31 +05:30
|
|
|
<p id="Slots">Ad Slots : <%= ad_slots %></p>
|
2018-04-08 06:39:20 +05:30
|
|
|
<% end %>
|
|
|
|
<% if engage_types %>
|
2018-04-11 07:39:31 +05:30
|
|
|
<p id="Engage">Engage Types : <%= engage_types %></p>
|
2018-04-08 06:39:20 +05:30
|
|
|
<% end %>
|
|
|
|
<% if ad_tag %>
|
2018-04-11 07:39:31 +05:30
|
|
|
<p id="Category">Ad Category : <%= ad_category %></p>
|
|
|
|
<p id="Tags">Ad Tags(?) : <%= k2 %></p>
|
2018-04-08 06:39:20 +05:30
|
|
|
<% end %>
|
2018-03-16 22:44:40 +05:30
|
|
|
</div>
|
2018-03-11 22:35:56 +05:30
|
|
|
</div>
|
2018-01-16 08:00:57 +05:30
|
|
|
|
2018-01-17 01:28:08 +05:30
|
|
|
<div class="pure-u-1 pure-u-md-3-5">
|
2018-04-18 02:23:12 +05:30
|
|
|
<div class="h-box">
|
2018-03-16 22:44:40 +05:30
|
|
|
<p>
|
2018-06-03 08:45:15 +05:30
|
|
|
<a href="/channel/<%= video.ucid %>">
|
|
|
|
<h3><%= video.author %></h3>
|
2018-03-16 22:44:40 +05:30
|
|
|
</a>
|
|
|
|
</p>
|
2018-07-16 21:54:24 +05:30
|
|
|
<% if user %>
|
2018-06-03 08:45:15 +05:30
|
|
|
<% if subscriptions.includes? video.ucid %>
|
2018-03-31 20:21:14 +05:30
|
|
|
<p>
|
2018-06-03 08:45:15 +05:30
|
|
|
<a href="/subscription_ajax?action_remove_subscriptions=1&c=<%= video.ucid %>">
|
|
|
|
<b>Unsubscribe from <%= video.author %></b>
|
2018-03-31 20:21:14 +05:30
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% else %>
|
|
|
|
<p>
|
2018-06-03 08:45:15 +05:30
|
|
|
<a href="/subscription_ajax?action_create_subscription_to_channel=1&c=<%= video.ucid %>">
|
|
|
|
<b>Subscribe to <%= video.author %></b>
|
2018-03-31 20:21:14 +05:30
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
2018-05-04 07:06:27 +05:30
|
|
|
<% else %>
|
|
|
|
<p>
|
|
|
|
<a href="/login">
|
2018-06-03 08:45:15 +05:30
|
|
|
<b>Login to subscribe to <%= video.author %></b>
|
2018-05-04 07:06:27 +05:30
|
|
|
</a>
|
|
|
|
</p>
|
2018-03-31 20:21:14 +05:30
|
|
|
<% end %>
|
2018-03-16 22:44:40 +05:30
|
|
|
<p>
|
|
|
|
<b>Shared <%= video.published.to_s("%B %-d, %Y") %></b>
|
|
|
|
</p>
|
2018-04-18 02:23:12 +05:30
|
|
|
<div>
|
2018-03-16 22:44:40 +05:30
|
|
|
<%= video.description %>
|
|
|
|
</div>
|
2018-03-11 22:35:56 +05:30
|
|
|
<hr style="margin-left:1em; margin-right:1em;">
|
2018-07-21 01:06:23 +05:30
|
|
|
<div id="comments">
|
|
|
|
<h3><center><i class="loading fas fa-spinner"></i></center></h3>
|
2018-03-13 05:06:08 +05:30
|
|
|
</div>
|
2018-03-14 05:07:56 +05:30
|
|
|
</div>
|
2018-03-11 22:35:56 +05:30
|
|
|
</div>
|
2018-01-17 01:28:08 +05:30
|
|
|
<div class="pure-u-1 pure-u-md-1-5">
|
2018-04-18 02:23:12 +05:30
|
|
|
<div class="h-box">
|
2018-03-16 22:44:40 +05:30
|
|
|
<% rvs.each do |rv| %>
|
|
|
|
<% if rv.has_key?("id") %>
|
|
|
|
<a href="/watch?v=<%= rv["id"] %>">
|
|
|
|
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
|
|
|
|
<p style="width:100%"><%= rv["title"] %></p>
|
|
|
|
<p>
|
|
|
|
<b style="width: 100%"><%= rv["author"] %></b>
|
|
|
|
</p>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
2018-01-15 08:46:09 +05:30
|
|
|
<% end %>
|
2018-03-16 22:44:40 +05:30
|
|
|
</div>
|
2018-01-07 23:20:04 +05:30
|
|
|
</div>
|
2018-01-17 01:28:08 +05:30
|
|
|
</div>
|