diff --git a/html/poketube.ejs b/html/poketube.ejs
index 1f999806..823f3f57 100644
--- a/html/poketube.ejs
+++ b/html/poketube.ejs
@@ -1579,8 +1579,10 @@ display: block; !important;" autoplay controls>
-
+ <% if (inv_vid.recommendedVideos.length > 1) { %>
+
+
+
+
+ <% } %>
+
<% if (!r) { %>
+ <% if (inv_vid.recommendedVideos.length > 1) { %>
-
+ <% } %>
+
<% if (!f) { %>
+
+<% if (inv_vid.recommendedVideos) { %>
+
<% inv_vid?.recommendedVideos.forEach(x => { %>
<% }) %>
+
+
<% } %>
-
+ <% } %>
+
+ <% if (inv_vid.recommendedVideos.length < 1) { %>
+ <% channel_uploads.latestVideos.forEach(x => { %>
+
+ <% }) %>
+ <% } %>
+
<% if (f) { %>
<% tj.forEach(x => { %>
@@ -1730,7 +1774,7 @@ Recommended Videos
}
- <% if (inv_vid?.recommendedVideos) { %>
+ <% if (Array.isArray(inv_vid.recommendedVideos) && inv_vid.recommendedVideos.length > 1) { %>
let checkbox = document.getElementById("continue");
@@ -1738,10 +1782,10 @@ checkbox.addEventListener('change', function(e) {
if (checkbox.checked) {
console.log("[AUTOPLAY] enabled");
document.getElementById('video').addEventListener('ended', autoplaynextvideo, false);
- let url = window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId %>";
+ let url = window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0]?.videoId %>";
function autoplaynextvideo(e) {
- location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>";
+ location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0]?.videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>";
}
}
if (/[?&]autoplay=/.test(location.search)) {