129 lines
3.8 KiB
HTML
129 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{episodename}}</title>
|
|
<style>
|
|
body, head, html {
|
|
padding: 0px;
|
|
border: 0px;
|
|
margin: 0px;
|
|
background-color: black;
|
|
}
|
|
/*body {
|
|
overflow:hidden;}*/
|
|
video {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
background-color: black;
|
|
z-index: 0;
|
|
}
|
|
.fine-text {
|
|
background-color: #444;
|
|
color: #FFF
|
|
}
|
|
.finish
|
|
{
|
|
z-index: 1;
|
|
position: absolute;
|
|
right: 0px;
|
|
bottom: 4em;
|
|
width: 13em;
|
|
height: 3em;
|
|
background-color: #444;
|
|
color: #FFF
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<video autoplay id="video" src="{{episodebrowserurl}}" poster="{{episodeposter}}" controls>
|
|
<!--langcode=langCode,name=languageName,file=subtitle.VttUrl-->
|
|
{{for lang in subtitles}}
|
|
<track
|
|
label="{{lang.name}}"
|
|
kind="subtitles"
|
|
srclang="{{lang.langcode}}"
|
|
src="{{lang.file}}"
|
|
/>
|
|
{{end}}
|
|
</video>
|
|
|
|
<div class="finish" id="finish" hidden>
|
|
Finishing in <span class="fine-text" id="seconds">0</span> seconds<br>
|
|
<button onclick="next_episode()">Next Episode -></button>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
const video=document.getElementById('video');
|
|
video.ontimeupdate=()=>tick();
|
|
video.onended=()=>next_episode();
|
|
const finish = document.getElementById('finish');
|
|
const seconds = document.getElementById('seconds');
|
|
|
|
function next_episode()
|
|
{
|
|
if(has_next_episode){
|
|
curepisode = next_episode_episode;
|
|
curseason = next_episode_season;
|
|
window.history.replaceState(null,'',next_episode_page_url);
|
|
video.innerHTML = next_subtitles_html;
|
|
video.poster = next_poster_url;
|
|
video.src = next_episode_url;
|
|
window.document.title = next_episode_name;
|
|
check_next_episode();
|
|
video.play();
|
|
}
|
|
|
|
}
|
|
|
|
function tick()
|
|
{
|
|
var secondsLeft=video.duration - video.currentTime;
|
|
|
|
seconds.innerText=Math.floor(secondsLeft).toString();
|
|
finish.hidden=true;
|
|
if(has_next_episode){
|
|
finish.hidden=secondsLeft > 60;
|
|
}
|
|
|
|
}
|
|
|
|
var has_next_episode = false;
|
|
var curseason ={{curseason}};
|
|
var curepisode={{curepisode}};
|
|
var next_episode_episode=0;
|
|
var next_episode_season=0;
|
|
var next_episode_name="";
|
|
var next_episode_url="";
|
|
var next_subtitles_html = "";
|
|
var next_poster_url ="";
|
|
var next_episode_page_url="";
|
|
navigator.mediaSession.setActionHandler('nexttrack', function() {
|
|
next_episode();
|
|
});
|
|
|
|
|
|
|
|
function check_next_episode()
|
|
{
|
|
fetch(`{{nextepisodeapi}}&season=${curseason}&episode=${curepisode}`).then(e=>e.json()).then(e=>{
|
|
has_next_episode = e.has_next_episode;
|
|
if(has_next_episode)
|
|
{
|
|
next_episode_episode = e.next_episode_episode;
|
|
next_episode_season = e.next_episode_season;
|
|
next_episode_name = e.next_episode_name;
|
|
next_episode_url = e.next_episode_url;
|
|
next_subtitles_html=e.next_subtitles_html;
|
|
next_poster_url = e.next_poster_url;
|
|
next_episode_page_url=e.next_episode_page_url;
|
|
}
|
|
});
|
|
}
|
|
check_next_episode();
|
|
</script>
|
|
</body>
|
|
</html> |