69 lines
3.4 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container" style="text-align: center">
<video id="player" class="video-js vjs-big-play-centered" style="display: inline-block" controls preload="auto" width="1100"
poster="https://image.tmdb.org/t/p/original{{ movie.backdrop_path }}" data-setup="{}">
{% if movie.extended and movie.directors_cut %}
<source src="{{ url_for("tv_movies.index") }}/get_movie/{{ movie.imdb_id }}?extended=True&directors_cut=True" type="video/webm">
{% elif movie.extended %}
<source src="{{ url_for("tv_movies.index") }}/get_movie/{{ movie.imdb_id }}?extended=True" type="video/webm">
{% elif movie.directors_cut %}
<source src="{{ url_for("tv_movies.index") }}/get_movie/{{ movie.imdb_id }}?directors_cut=True" type="video/webm">
{% else %}
<source src="{{ url_for("tv_movies.index") }}/get_movie/{{ movie.imdb_id }}" type="video/webm">
{% endif %}
<p class='vjs-no-js'>
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
</p>
</video>
<h1>{{ movie.title }}</h1>
<p style="text-align: left">{{ movie.description }}</p>
<a class="btn btn-primary" href="{{ url_for("tv_movies.index") }}/get_movie/{{ movie.imdb_id }}{% if movie.extended == 1 %}/extended{% endif %}{% if movie.directors_cut==1 %}/directors_cut{% endif %}" download="{{ movie.title }}">Download</a>
</div>
{% endblock %}
{% block footer_content %}
<div class="container">
<img src="/static/svg/tmdb.svg" alt="" style="height: 40px;">
<p>This product uses the TMDb API but is not endorsed or certified by TMDb.</p>
</div>
<script>
videojs("player").ready(function(){
let myPlayer = videojs.getPlayer("player");
let saved_time = {{ user_data.time }};
let length = 0;
if (saved_time > 5) {
myPlayer.currentTime(saved_time);
}
function reqListener() {
console.log(this.responseText);
}
let time = myPlayer.currentTime();
let timestamp = document.getElementById("timestamp");
myPlayer.on("timeupdate", function () {
if (myPlayer.currentTime()-time >= 10) {
length = myPlayer.duration();
let oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("POST", "https://rpi.narnian.us/tv_movies/{{ movie.imdb_id }}?time="+(time+5)+"&length="+length{% if movie.extended %}+"&extended=True"{% endif %}{% if movie.directors_cut %}+"&directors_cut=True"{% endif %});
oReq.send();
time = myPlayer.currentTime();
}
});
myPlayer.on("pause", function () {
length = myPlayer.duration();
let oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("POST", "https://rpi.narnian.us/tv_movies/{{ movie.imdb_id }}?time="+(time+5)+"&length="+length{% if movie.extended %}+"&extended=True"{% endif %}{% if movie.directors_cut %}+"&directors_cut=True"{% endif %});
oReq.send();
time = myPlayer.currentTime();
});
});
</script>
{% endblock footer_content %}