616 lines
16 KiB
HTML
616 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title data-i18n="mobile.camera_streams">📱 Camera Streams</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui, viewport-fit=cover">
|
|
<link rel="stylesheet" href="/static/css/base.css">
|
|
<link rel="stylesheet" href="/static/css/navbar.css">
|
|
<link rel="stylesheet" href="/static/css/buttons.css">
|
|
<link rel="stylesheet" href="/static/css/components.css">
|
|
<link rel="stylesheet" href="/static/css/responsive.css">
|
|
<style>
|
|
/* Mobile streams specific styles */
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: #000;
|
|
font-family: Arial, sans-serif;
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
overflow-x: hidden;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
.mobile-navbar {
|
|
background: white;
|
|
color: black;
|
|
padding: 15px 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
border-bottom: 2px solid #ccc;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
}
|
|
|
|
.navbar-title {
|
|
font-size: 1.4rem;
|
|
font-weight: bold;
|
|
color: #333;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.navbar-controls {
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.nav-btn {
|
|
background: #f8f9fa;
|
|
border: 2px solid #e9ecef;
|
|
cursor: pointer;
|
|
padding: 8px 12px;
|
|
border-radius: 8px;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
color: #333;
|
|
text-decoration: none;
|
|
font-weight: bold;
|
|
font-size: 0.8rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
min-width: 44px;
|
|
justify-content: center;
|
|
}
|
|
|
|
.nav-btn:hover {
|
|
background: #e9ecef;
|
|
border-color: #28a745;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
transform: translateY(-1px);
|
|
color: #28a745;
|
|
}
|
|
|
|
.nav-btn.active {
|
|
background: #28a745;
|
|
border-color: #1e7e34;
|
|
color: white;
|
|
}
|
|
|
|
.nav-btn.active:hover {
|
|
background: #1e7e34;
|
|
color: white;
|
|
}
|
|
|
|
.nav-btn.disabled {
|
|
opacity: 0.5;
|
|
pointer-events: none;
|
|
background: #f1f3f4;
|
|
border-color: #dadce0;
|
|
}
|
|
|
|
.container {
|
|
padding: 20px;
|
|
background: #000;
|
|
min-height: calc(100vh - 70px);
|
|
min-height: calc(100dvh - 70px);
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* Camera Selection Grid */
|
|
.camera-selection {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 15px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
@media (orientation: portrait) {
|
|
.camera-selection {
|
|
grid-template-columns: 1fr;
|
|
gap: 12px;
|
|
}
|
|
}
|
|
|
|
.camera-option {
|
|
background: #1a1a1a;
|
|
border: 2px solid #333;
|
|
border-radius: 12px;
|
|
padding: 0;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
|
|
text-decoration: none;
|
|
color: white;
|
|
min-height: 140px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
@media (orientation: portrait) {
|
|
.camera-option {
|
|
min-height: 180px;
|
|
}
|
|
}
|
|
|
|
.camera-option::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
|
|
transition: left 0.5s ease;
|
|
z-index: 2;
|
|
}
|
|
|
|
.camera-option:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.camera-option:hover {
|
|
border-color: #28a745;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
|
|
}
|
|
|
|
.camera-option:active {
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.stream-preview {
|
|
flex: 1;
|
|
width: 100%;
|
|
position: relative;
|
|
background: #000;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.stream-img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
transition: opacity 0.3s ease;
|
|
background: #000;
|
|
}
|
|
|
|
.stream-loading {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
color: #999;
|
|
font-size: 0.9rem;
|
|
z-index: 1;
|
|
}
|
|
|
|
.camera-info {
|
|
background: #000;
|
|
padding: 12px 15px;
|
|
border-top: 1px solid #333;
|
|
position: relative;
|
|
z-index: 3;
|
|
}
|
|
|
|
.camera-title {
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
color: white;
|
|
line-height: 1.2;
|
|
text-align: center;
|
|
}
|
|
|
|
/* Style for unavailable/empty streams - grey out the camera title */
|
|
.camera-option .stream-preview.unavailable ~ .camera-info .camera-title {
|
|
color: #999;
|
|
}
|
|
|
|
@media (orientation: portrait) {
|
|
.camera-info {
|
|
padding: 10px 12px;
|
|
}
|
|
|
|
.camera-title {
|
|
font-size: 0.9rem;
|
|
}
|
|
}
|
|
|
|
@media (orientation: landscape) {
|
|
.camera-selection {
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 12px;
|
|
}
|
|
|
|
.camera-option {
|
|
min-height: 120px;
|
|
}
|
|
|
|
.stream-preview {
|
|
min-height: 80px;
|
|
}
|
|
|
|
.camera-info {
|
|
padding: 8px 10px;
|
|
}
|
|
|
|
.camera-title {
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.navbar-controls {
|
|
gap: 6px;
|
|
}
|
|
|
|
.nav-btn {
|
|
padding: 6px 10px;
|
|
font-size: 0.75rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.container {
|
|
padding: 15px;
|
|
}
|
|
|
|
.camera-selection {
|
|
gap: 12px;
|
|
}
|
|
|
|
.camera-option {
|
|
min-height: 130px;
|
|
}
|
|
|
|
.camera-info {
|
|
padding: 12px 15px;
|
|
}
|
|
|
|
.camera-title {
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.navbar-controls {
|
|
gap: 6px;
|
|
}
|
|
|
|
.nav-btn {
|
|
padding: 6px 8px;
|
|
font-size: 0.75rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 320px) {
|
|
.camera-selection {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.camera-option {
|
|
min-height: 120px;
|
|
}
|
|
}
|
|
|
|
/* Floating fullscreen button */
|
|
.floating-fullscreen-btn {
|
|
position: fixed;
|
|
bottom: 30px;
|
|
right: 30px;
|
|
width: 60px;
|
|
height: 60px;
|
|
background: rgba(0, 123, 255, 0.9);
|
|
border: none;
|
|
border-radius: 50%;
|
|
color: white;
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
z-index: 1000;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
transition: all 0.3s ease;
|
|
backdrop-filter: blur(10px);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.floating-fullscreen-btn:hover {
|
|
background: rgba(0, 123, 255, 1);
|
|
transform: scale(1.1);
|
|
box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
|
|
}
|
|
|
|
.floating-fullscreen-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.floating-fullscreen-btn.hidden {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transform: scale(0.8);
|
|
}
|
|
|
|
/* Tournament status indicator */
|
|
.tournament-indicator {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
background: #28a745;
|
|
color: white;
|
|
padding: 2px 6px;
|
|
border-radius: 8px;
|
|
font-size: 0.7rem;
|
|
font-weight: bold;
|
|
margin-left: 5px;
|
|
}
|
|
|
|
/* Results available indicator */
|
|
.results-indicator {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
background: #28a745;
|
|
color: white;
|
|
padding: 2px 6px;
|
|
border-radius: 8px;
|
|
font-size: 0.7rem;
|
|
font-weight: bold;
|
|
margin-left: 5px;
|
|
}
|
|
</style>
|
|
<script src="/static/js/i18n.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="mobile-navbar">
|
|
<div class="navbar-title">
|
|
<span data-i18n="mobile.camera_streams">📷 Prenosi Kamer</span>
|
|
{% if tournament_active %}
|
|
<span class="tournament-indicator">LIVE</span>
|
|
{% elif results_available %}
|
|
<span class="results-indicator">FINAL</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="navbar-controls">
|
|
<!-- Mobile users stay on mobile - no desktop access -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="camera-selection">
|
|
{% for i in range(1, 7) %}
|
|
{% set camera_id = i %}
|
|
<div class="camera-option" onclick="openCameraFullscreen({{ camera_id }})">
|
|
<div class="stream-preview">
|
|
<div class="stream-loading" data-i18n="general.loading">Nalaganje...</div>
|
|
<img src="{{ streams[i-1].url }}"
|
|
alt="Camera {{ camera_id }}"
|
|
class="stream-img"
|
|
onerror="handleStreamError(this, {{ camera_id }})"
|
|
onload="handleStreamLoad(this)">
|
|
</div>
|
|
<div class="camera-info">
|
|
<div class="camera-title">
|
|
{% if tournament_active and current_round_data and (i-1) < current_round_data.players|length %}
|
|
{{ current_round_data.players[i-1].name }}
|
|
{% else %}
|
|
{{ settings.camera_titles[camera_id|string] }}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Floating fullscreen button -->
|
|
<button class="floating-fullscreen-btn" onclick="toggleFullscreen()" id="fullscreenBtn">
|
|
⛶
|
|
</button>
|
|
|
|
<script>
|
|
function handleStreamError(img, cameraId) {
|
|
const streamPreview = img.parentElement;
|
|
const loadingIndicator = streamPreview.querySelector('.stream-loading');
|
|
|
|
// Add unavailable class to stream-preview
|
|
streamPreview.classList.add('unavailable');
|
|
|
|
if (loadingIndicator) {
|
|
loadingIndicator.textContent = 'Unavailable';
|
|
loadingIndicator.style.color = '#ff6b6b';
|
|
}
|
|
img.style.opacity = '0.1';
|
|
}
|
|
|
|
function handleStreamLoad(img) {
|
|
const loadingIndicator = img.parentElement.querySelector('.stream-loading');
|
|
if (loadingIndicator) {
|
|
loadingIndicator.style.display = 'none';
|
|
}
|
|
img.style.opacity = '1';
|
|
}
|
|
|
|
function openCameraFullscreen(cameraId) {
|
|
{% if tournament_active and current_round_data %}
|
|
const players = {{ current_round_data.players|tojson }};
|
|
let customTitle = `Camera ${cameraId}`;
|
|
if (cameraId <= players.length) {
|
|
customTitle = players[cameraId - 1].name;
|
|
}
|
|
{% else %}
|
|
const titles = {{ settings.camera_titles|tojson }};
|
|
const customTitle = titles[cameraId.toString()] || `Camera ${cameraId}`;
|
|
{% endif %}
|
|
|
|
const fullscreenUrl = `/fullscreen/${cameraId}?title=${encodeURIComponent(customTitle)}`;
|
|
|
|
if (screen.orientation && screen.orientation.lock) {
|
|
screen.orientation.lock('landscape').then(() => {
|
|
window.location.href = fullscreenUrl;
|
|
}).catch(() => {
|
|
window.location.href = fullscreenUrl;
|
|
});
|
|
} else {
|
|
window.location.href = fullscreenUrl;
|
|
}
|
|
}
|
|
|
|
function addMobileTouchFeedback() {
|
|
const touchElements = document.querySelectorAll('.camera-option, .nav-btn:not(.disabled), .floating-fullscreen-btn');
|
|
|
|
touchElements.forEach(element => {
|
|
element.addEventListener('touchstart', function(e) {
|
|
if (!this.disabled && !this.classList.contains('hidden')) {
|
|
this.style.transform = 'scale(0.95) translateY(0)';
|
|
this.style.transition = 'transform 0.1s ease';
|
|
}
|
|
});
|
|
|
|
element.addEventListener('touchend', function(e) {
|
|
if (!this.disabled && !this.classList.contains('hidden')) {
|
|
setTimeout(() => {
|
|
this.style.transform = '';
|
|
this.style.transition = 'transform 0.2s ease';
|
|
}, 100);
|
|
}
|
|
});
|
|
|
|
element.addEventListener('touchcancel', function(e) {
|
|
if (!this.disabled && !this.classList.contains('hidden')) {
|
|
this.style.transform = '';
|
|
this.style.transition = 'transform 0.2s ease';
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// Keyboard shortcuts for quick camera selection
|
|
document.addEventListener('keydown', function(event) {
|
|
if (event.key >= '1' && event.key <= '6') {
|
|
const cameraId = parseInt(event.key);
|
|
openCameraFullscreen(cameraId);
|
|
}
|
|
});
|
|
|
|
function toggleFullscreen() {
|
|
const elem = document.documentElement;
|
|
|
|
if (!document.fullscreenElement) {
|
|
if (elem.requestFullscreen) {
|
|
elem.requestFullscreen();
|
|
} else if (elem.mozRequestFullScreen) {
|
|
elem.mozRequestFullScreen();
|
|
} else if (elem.webkitRequestFullscreen) {
|
|
elem.webkitRequestFullscreen();
|
|
} else if (elem.msRequestFullscreen) {
|
|
elem.msRequestFullscreen();
|
|
}
|
|
} else {
|
|
if (document.exitFullscreen) {
|
|
document.exitFullscreen();
|
|
} else if (document.mozCancelFullScreen) {
|
|
document.mozCancelFullScreen();
|
|
} else if (document.webkitExitFullscreen) {
|
|
document.webkitExitFullscreen();
|
|
} else if (document.msExitFullscreen) {
|
|
document.msExitFullscreen();
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleFullscreenChange() {
|
|
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
|
if (!fullscreenBtn) return;
|
|
|
|
const isFullscreen = document.fullscreenElement ||
|
|
document.mozFullScreenElement ||
|
|
document.webkitFullscreenElement ||
|
|
document.msFullscreenElement;
|
|
|
|
if (isFullscreen) {
|
|
fullscreenBtn.textContent = '⛶';
|
|
fullscreenBtn.classList.remove('hidden');
|
|
} else {
|
|
fullscreenBtn.textContent = '⛶';
|
|
fullscreenBtn.classList.remove('hidden');
|
|
|
|
// If we're coming back from a fullscreen camera view, redirect to streams
|
|
if (window.location.pathname.includes('/fullscreen/')) {
|
|
window.location.href = '/mobile/streams';
|
|
}
|
|
}
|
|
}
|
|
|
|
// Initialize
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
addMobileTouchFeedback();
|
|
handleFullscreenChange();
|
|
|
|
// Add fullscreen event listeners
|
|
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('mozfullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('msfullscreenchange', handleFullscreenChange);
|
|
|
|
console.log('📱 Mobile camera selection loaded with fixed navigation');
|
|
console.log('🏆 Tournament active:', {{ 'true' if tournament_active else 'false' }});
|
|
console.log('📊 Results available:', {{ 'true' if results_available else 'false' }});
|
|
|
|
setTimeout(() => {
|
|
if (window.innerHeight < window.screen.height) {
|
|
window.scrollBy(0, 1);
|
|
setTimeout(() => window.scrollBy(0, -1), 100);
|
|
}
|
|
}, 500);
|
|
|
|
// Only refresh streams if page is visible
|
|
setInterval(() => {
|
|
if (document.visibilityState !== 'visible') return;
|
|
|
|
const streams = document.querySelectorAll('.stream-img');
|
|
streams.forEach(stream => {
|
|
if (stream.complete && stream.naturalHeight === 0) {
|
|
stream.src = stream.src.split('?')[0] + '?refresh=' + Date.now();
|
|
}
|
|
});
|
|
}, 60000); // Reduced from 30s to 60s
|
|
|
|
if (window.innerHeight > window.innerWidth) {
|
|
const hint = document.createElement('div');
|
|
hint.style.cssText = `
|
|
position: fixed;
|
|
bottom: 90px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background: rgba(0, 0, 0, 0.8);
|
|
color: white;
|
|
padding: 10px 20px;
|
|
border-radius: 20px;
|
|
font-size: 0.9rem;
|
|
z-index: 999;
|
|
text-align: center;
|
|
`;
|
|
hint.textContent = '📱 Rotate to landscape or tap ⛶ for fullscreen';
|
|
document.body.appendChild(hint);
|
|
|
|
setTimeout(() => {
|
|
if (hint.parentNode) {
|
|
hint.parentNode.removeChild(hint);
|
|
}
|
|
}, 5000);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |