njpma/app/templates/film.html

84 lines
2 KiB
HTML
Raw Normal View History

2021-09-28 13:10:22 +00:00
{% extends "base.html" %}
{% block main %}
2021-10-10 15:06:43 +00:00
<div class="film">
<div class="info">
2021-09-28 13:10:22 +00:00
<h1>{{ film.data.title | safe }}</h1>
2021-10-11 09:43:07 +00:00
{% comment %}
2021-09-28 13:10:22 +00:00
<h2>{{ film.data.director|join:", "|safe }}</h2>
2021-10-11 09:43:07 +00:00
{% endcomment %}
2021-09-28 13:10:22 +00:00
<p>{{ film.data.summary|safe }}</p>
2021-10-11 14:33:24 +00:00
<div class="details">
Runtime: {{ film.duration }},
Year: {{ film.data.date}},
Artist Bio: {{ film.data.bio|safe }}
</div>
2021-09-30 17:30:36 +00:00
</div>
2021-10-10 15:06:43 +00:00
<video src="{{ settings.TIMELINE_PREFIX }}{{ film.padma_id }}/loop.mp4" autoplay loop muted></video>
<div class="play">
<div>
2021-10-11 09:43:07 +00:00
<a href="" id="play-fullscreen">Play</a>
2021-10-10 15:06:43 +00:00
</div>
2021-10-11 13:06:49 +00:00
<div class="texts">
{% for text in film.related_texts %}
<div class="text">
<a href="{{ text.get_absolute_url }}">
{{ text.title }}<br>
{{ text.byline }}
</a>
</div>
{% endfor %}
2021-10-10 15:06:43 +00:00
</div>
2021-09-30 17:30:36 +00:00
</div>
{% endblock %}
{% block end %}
<script>
var film = {
id: "{{ film.padma_id }}",
}
</script>
<script>
document.querySelector('a#play-fullscreen').addEventListener('click', event => {
var video = document.createElement('video')
video.classList.add('player')
video.src = 'https://pad.ma/' + film.id + '/480p.webm'
video.controls = true
document.querySelector('main').appendChild(video)
video.style.display = 'none'
function enterFullscreen(event) {
video.requestFullscreen().catch(err => {
console.log(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`);
});
video.removeEventListener('play', enterFullscreen);
setTimeout(() => {
video.style.display = 'block'
}, 150)
}
video.addEventListener('play', enterFullscreen);
video.addEventListener('fullscreenchange', event => {
if (!document.fullscreen) {
video.remove()
if (document.fullscreenElement) {
document.exitFullscreen();
}
}
});
video.addEventListener('pause', event => {
})
video.addEventListener('ended', event => {
video.remove()
if (document.fullscreenElement) {
document.exitFullscreen();
}
});
video.play()
event.preventDefault()
event.stopPropagation()
})
</script>
2021-09-28 13:10:22 +00:00
{% endblock %}