diff --git a/html/poketube.ejs b/html/poketube.ejs index 65029061..e5670e59 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -671,13 +671,16 @@ background-color: #0000; html:fullscreen *:not(html, video, body, ptd-app-ejs, .app, .watch-page, .primary, .video-player-container, #popupMenu, #popupMenu *) { visibility: hidden !important; } - #nojs-high-res-warning { + .error-card { background-color: #823434aa; margin: 30px; padding: 5px 20px; border: 2px solid red; border-radius: 10px; } + #buffer-failed-warning { + display: none; + } .rainbow-gradient { background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); @@ -710,6 +713,31 @@ background-color: #0000; } return timeString; } + function showErrorCard(e) { + try { + switch (e.target.error.code) { + case e.target.error.MEDIA_ERR_ABORTED: + return; + break; + case e.target.error.MEDIA_ERR_NETWORK: + document.querySelector("div p span").innerText = "(Network error)" + break; + case e.target.error.MEDIA_ERR_DECODE: + document.querySelector("div p span").innerText = "(Decode error/lack of browser support)" + break; + case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED: + document.querySelector("div p span").innerText = "(Network error or format not supported)" + break; + default: + document.querySelector("div p span").innerText = "(Unknown error)" + break; + } + } + catch { + document.querySelector("div p span").innerText = "(Network error)" + } + document.getElementById("buffer-failed-warning").style.display = "block"; + } document.addEventListener("DOMContentLoaded", () => { //FIXME: saved playback intentionally overwritten localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0); @@ -760,6 +788,15 @@ background-color: #0000; }, 800) } }, 1000) + setInterval(() => { + if(Math.round(video.currentTime) != Math.round(aud.currentTime)) { + video.pause(); aud.pause(); playPauseButton.innerHTML = playSVG; + video.currentTime > aud.currentTime ? aud.currentTime = video.currentTime : video.currentTime = aud.currentTime; + setTimeout(() => { + video.play(); aud.play(); playPauseButton.innerHTML = pauseSVG; + }, 800) + } + }, 1000) video.addEventListener("click", toggleVideo); video.addEventListener("dblclick", () => { document.documentElement.requestFullscreen(); @@ -1252,19 +1289,28 @@ Offical Discord Server! :3 <% if (!qua) { //TODO - a %> - + <% } else { %> <% } %> <% if (!qua) { %> - + Due to YouTube's recent changes on high resolution playback, it is sadly impossible to play high-resolution video with audio without client-side JavaScript enabled. Switch to SD quality or enable JavaScript to play your video with audio. <% } %> - + + + Oh no, the video couldn't be loaded :( + + You can try refreshing the page! + + + + + <% if (isvidious) { %> <% if (!qua) { %> <% @@ -1275,30 +1321,30 @@ Offical Discord Server! :3 } }); %> - + <% } %> <% if (qua === "medium") { %> - + <% } %> <% } %> <% if (!isSchoolProxy) { %> <% if (!isvidious) { %> <% if (!qua) { %> - + <% } %> <% if (qua === "medium") { %> - + <% } %> <% } %> <% } %> <% if (isSchoolProxy) { %> <% if (!qua) { %> - + <% } %> <% if (qua === "medium") { %> - + <% } %> <% } %>
Due to YouTube's recent changes on high resolution playback, it is sadly impossible to play high-resolution video with audio without client-side JavaScript enabled. Switch to SD quality or enable JavaScript to play your video with audio.
+ Oh no, the video couldn't be loaded :( + + You can try refreshing the page! + + +