Files
digiserver/templates/player_fullscreen.html
2025-02-01 21:40:46 +02:00

68 lines
2.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Player Fullscreen</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: black;
margin: 0;
overflow: hidden;
}
.content-item {
display: none;
width: 100vw;
height: 100vh;
object-fit: cover;
}
.content-item.active {
display: block;
}
</style>
</head>
<body>
<div id="content">
{% for item in content %}
{% if item.file_name.endswith('.mp4') %}
<video class="content-item" data-duration="{{ item.duration }}" controls>
<source src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
{% elif item.file_name.endswith('.pdf') %}
<object data="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" type="application/pdf" class="content-item" data-duration="{{ item.duration }}"></object>
{% else %}
<img src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" class="content-item" data-duration="{{ item.duration }}" alt="{{ item.file_name }}">
{% endif %}
{% endfor %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const items = document.querySelectorAll('.content-item');
let currentIndex = 0;
function showNextItem() {
items.forEach(item => item.classList.remove('active'));
const currentItem = items[currentIndex];
currentItem.classList.add('active');
const duration = parseInt(currentItem.getAttribute('data-duration'), 10) * 1000;
if (currentItem.tagName === 'VIDEO') {
currentItem.play();
currentItem.onended = () => {
currentIndex = (currentIndex + 1) % items.length;
showNextItem();
};
} else {
setTimeout(() => {
currentIndex = (currentIndex + 1) % items.length;
showNextItem();
}, duration);
}
}
showNextItem();
});
</script>
</body>
</html>