mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 15:38:14 +01:00
add error notices :3
This commit is contained in:
parent
8d60655fa7
commit
5be52a9d7b
1 changed files with 56 additions and 10 deletions
|
@ -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 *) {
|
html:fullscreen *:not(html, video, body, ptd-app-ejs, .app, .watch-page, .primary, .video-player-container, #popupMenu, #popupMenu *) {
|
||||||
visibility: hidden !important;
|
visibility: hidden !important;
|
||||||
}
|
}
|
||||||
#nojs-high-res-warning {
|
.error-card {
|
||||||
background-color: #823434aa;
|
background-color: #823434aa;
|
||||||
margin: 30px;
|
margin: 30px;
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
border: 2px solid red;
|
border: 2px solid red;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
#buffer-failed-warning {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.rainbow-gradient {
|
.rainbow-gradient {
|
||||||
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
|
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
|
||||||
|
@ -710,6 +713,31 @@ background-color: #0000;
|
||||||
}
|
}
|
||||||
return timeString;
|
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", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
//FIXME: saved playback intentionally overwritten
|
//FIXME: saved playback intentionally overwritten
|
||||||
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
||||||
|
@ -760,6 +788,15 @@ background-color: #0000;
|
||||||
}, 800)
|
}, 800)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 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("click", toggleVideo);
|
||||||
video.addEventListener("dblclick", () => {
|
video.addEventListener("dblclick", () => {
|
||||||
document.documentElement.requestFullscreen();
|
document.documentElement.requestFullscreen();
|
||||||
|
@ -1252,19 +1289,28 @@ Offical Discord Server! :3
|
||||||
|
|
||||||
<% if (!qua) { //TODO - a %>
|
<% if (!qua) { //TODO - a %>
|
||||||
<audio id="aud" preload>
|
<audio id="aud" preload>
|
||||||
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=140&local=true" type="video/mp4"/>
|
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=140&local=true" type="video/mp4" onerror="showErrorCard(event)"/>
|
||||||
</audio>
|
</audio>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<audio id="aud"></audio>
|
<audio id="aud"></audio>
|
||||||
<% } %>
|
<% } %>
|
||||||
<noscript>
|
<noscript>
|
||||||
<% if (!qua) { %>
|
<% if (!qua) { %>
|
||||||
<div id="nojs-high-res-warning">
|
<div id="nojs-high-res-warning" class="error-card">
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</noscript>
|
</noscript>
|
||||||
<video class="player video-ambient-container" id="video" style="border-radius: 16px; box-sizing: border-box; min-width: 100%; display: block;" preload>
|
<div id="buffer-failed-warning" class="error-card">
|
||||||
|
<p>
|
||||||
|
Oh no, the video couldn't be loaded :(
|
||||||
|
<br/>
|
||||||
|
You can try refreshing the page!
|
||||||
|
<br/>
|
||||||
|
<span></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<video class="player video-ambient-container" id="video" style="border-radius: 16px; box-sizing: border-box; min-width: 100%; display: block;" preload onerror="showErrorCard(event)">
|
||||||
<% if (isvidious) { %>
|
<% if (isvidious) { %>
|
||||||
<% if (!qua) { %>
|
<% if (!qua) { %>
|
||||||
<%
|
<%
|
||||||
|
@ -1275,30 +1321,30 @@ Offical Discord Server! :3
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
%>
|
%>
|
||||||
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=<%=itag%>&local=true" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true">
|
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=<%=itag%>&local=true" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true" onerror="showErrorCard(event)">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (qua === "medium") { %>
|
<% if (qua === "medium") { %>
|
||||||
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=18&local=true" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true">
|
<source src="<%=u%>/latest_version?id=<%=inv_vid.videoId%>&itag=18&local=true" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true" onerror="showErrorCard(event)">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (!isSchoolProxy) { %>
|
<% if (!isSchoolProxy) { %>
|
||||||
<% if (!isvidious) { %>
|
<% if (!isvidious) { %>
|
||||||
<% if (!qua) { %>
|
<% if (!qua) { %>
|
||||||
<source src="https://tube.kuylar.dev/proxy/media/<%=inv_vid.videoId%>/22" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true">
|
<source src="https://tube.kuylar.dev/proxy/media/<%=inv_vid.videoId%>/22" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true" onerror="showErrorCard(event)">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (qua === "medium") { %>
|
<% if (qua === "medium") { %>
|
||||||
<source src="https://tube.kuylar.dev/proxy/media/<%=inv_vid.videoId%>/18" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true">
|
<source src="https://tube.kuylar.dev/proxy/media/<%=inv_vid.videoId%>/18" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true" onerror="showErrorCard(event)">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (isSchoolProxy) { %>
|
<% if (isSchoolProxy) { %>
|
||||||
<% if (!qua) { %>
|
<% if (!qua) { %>
|
||||||
<source src="https://tube-proxy.ashley0143.xyz/proxy/media/<%=inv_vid.videoId%>/22" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true">
|
<source src="https://tube-proxy.ashley0143.xyz/proxy/media/<%=inv_vid.videoId%>/22" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="hd720" selected="true" onerror="showErrorCard()">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (qua === "medium") { %>
|
<% if (qua === "medium") { %>
|
||||||
<source src="https://tube-proxy.ashley0143.xyz/proxy/media/<%=inv_vid.videoId%>/18" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true">
|
<source src="https://tube-proxy.ashley0143.xyz/proxy/media/<%=inv_vid.videoId%>/18" type="video/mp4; codecs="avc1.64001F, mp4a.40.2"" label="sd360" selected="true" onerror="showErrorCard()">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue