670 lines
17 KiB
HTML
670 lines
17 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>📱 Camera Streams</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui, viewport-fit=cover">
|
|
<style>
|
|
* {
|
|
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: #007bff;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
transform: translateY(-1px);
|
|
color: #007bff;
|
|
}
|
|
|
|
.nav-btn.active {
|
|
background: #007bff;
|
|
border-color: #0056b3;
|
|
color: white;
|
|
}
|
|
|
|
.nav-btn.active:hover {
|
|
background: #0056b3;
|
|
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: #007bff;
|
|
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;
|
|
}
|
|
|
|
@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: 20px;
|
|
right: 20px;
|
|
width: 56px;
|
|
height: 56px;
|
|
background: #007bff;
|
|
border: none;
|
|
border-radius: 50%;
|
|
color: white;
|
|
font-size: 1.2rem;
|
|
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
|
|
cursor: pointer;
|
|
z-index: 1000;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.floating-fullscreen-btn:hover {
|
|
background: #0056b3;
|
|
transform: scale(1.1);
|
|
box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
|
|
}
|
|
|
|
.floating-fullscreen-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.floating-fullscreen-btn.hidden {
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* Hide floating button when in fullscreen */
|
|
:fullscreen .floating-fullscreen-btn,
|
|
:-webkit-full-screen .floating-fullscreen-btn,
|
|
:-moz-full-screen .floating-fullscreen-btn,
|
|
:-ms-fullscreen .floating-fullscreen-btn {
|
|
opacity: 0;
|
|
transform: scale(0);
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* Fullscreen adjustments */
|
|
:fullscreen .mobile-navbar,
|
|
:-webkit-full-screen .mobile-navbar,
|
|
:-moz-full-screen .mobile-navbar,
|
|
:-ms-fullscreen .mobile-navbar {
|
|
display: none !important;
|
|
}
|
|
|
|
:fullscreen .container,
|
|
:-webkit-full-screen .container,
|
|
:-moz-full-screen .container,
|
|
:-ms-fullscreen .container {
|
|
padding: 10px;
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
}
|
|
|
|
html:fullscreen .mobile-navbar,
|
|
html:-webkit-full-screen .mobile-navbar,
|
|
html:-moz-full-screen .mobile-navbar,
|
|
html:-ms-fullscreen .mobile-navbar {
|
|
display: none !important;
|
|
}
|
|
|
|
html:fullscreen .container,
|
|
html:-webkit-full-screen .container,
|
|
html:-moz-full-screen .container,
|
|
html:-ms-fullscreen .container {
|
|
padding: 10px;
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.floating-fullscreen-btn {
|
|
width: 60px;
|
|
height: 60px;
|
|
font-size: 1.3rem;
|
|
}
|
|
}
|
|
|
|
/* 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: #007bff;
|
|
color: white;
|
|
padding: 2px 6px;
|
|
border-radius: 8px;
|
|
font-size: 0.7rem;
|
|
font-weight: bold;
|
|
margin-left: 5px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="mobile-navbar">
|
|
<div class="navbar-title">
|
|
📷 Streams
|
|
{% if tournament_active %}
|
|
<span class="tournament-indicator">LIVE</span>
|
|
{% elif results_available %}
|
|
<span class="results-indicator">FINAL</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="navbar-controls">
|
|
<!-- Always show all 3 navigation buttons -->
|
|
<a href="/mobile/streams" class="nav-btn active">📷</a>
|
|
<a href="/mobile/draft" class="nav-btn">📋</a>
|
|
<a href="/mobile/results" class="nav-btn">🏆</a>
|
|
</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">Loading...</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" id="fullscreenBtn" onclick="toggleFullscreen()" title="Enter Fullscreen">
|
|
⛶
|
|
</button>
|
|
|
|
<script>
|
|
function handleStreamError(img, cameraId) {
|
|
const loadingIndicator = img.parentElement.querySelector('.stream-loading');
|
|
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);
|
|
} else if (event.key === 'f' || event.key === 'F') {
|
|
event.preventDefault();
|
|
toggleFullscreen();
|
|
}
|
|
});
|
|
|
|
// Fullscreen functionality
|
|
function toggleFullscreen() {
|
|
if (isFullscreen()) {
|
|
exitFullscreen();
|
|
} else {
|
|
enterFullscreen();
|
|
}
|
|
}
|
|
|
|
function isFullscreen() {
|
|
return document.fullscreenElement ||
|
|
document.webkitFullscreenElement ||
|
|
document.mozFullScreenElement ||
|
|
document.msFullscreenElement;
|
|
}
|
|
|
|
function enterFullscreen() {
|
|
const element = document.documentElement;
|
|
|
|
if (element.requestFullscreen) {
|
|
element.requestFullscreen().catch(err => console.log('Fullscreen error:', err));
|
|
} else if (element.webkitRequestFullscreen) {
|
|
element.webkitRequestFullscreen();
|
|
} else if (element.mozRequestFullScreen) {
|
|
element.mozRequestFullScreen();
|
|
} else if (element.msRequestFullscreen) {
|
|
element.msRequestFullscreen();
|
|
}
|
|
}
|
|
|
|
function exitFullscreen() {
|
|
if (document.exitFullscreen) {
|
|
document.exitFullscreen().catch(err => console.log('Exit fullscreen error:', err));
|
|
} else if (document.webkitExitFullscreen) {
|
|
document.webkitExitFullscreen();
|
|
} else if (document.mozCancelFullScreen) {
|
|
document.mozCancelFullScreen();
|
|
} else if (document.msExitFullscreen) {
|
|
document.msExitFullscreen();
|
|
}
|
|
}
|
|
|
|
function handleFullscreenChange() {
|
|
const fullscreenBtn = document.getElementById('fullscreenBtn');
|
|
const navbar = document.querySelector('.mobile-navbar');
|
|
const isFS = isFullscreen();
|
|
|
|
if (fullscreenBtn) {
|
|
if (isFS) {
|
|
fullscreenBtn.innerHTML = '⛉';
|
|
fullscreenBtn.title = 'Exit Fullscreen';
|
|
fullscreenBtn.classList.add('hidden');
|
|
|
|
if (navbar) {
|
|
navbar.style.display = 'none';
|
|
}
|
|
} else {
|
|
fullscreenBtn.innerHTML = '⛶';
|
|
fullscreenBtn.title = 'Enter Fullscreen';
|
|
fullscreenBtn.classList.remove('hidden');
|
|
|
|
if (navbar) {
|
|
navbar.style.display = 'flex';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('mozfullscreenchange', handleFullscreenChange);
|
|
document.addEventListener('MSFullscreenChange', handleFullscreenChange);
|
|
|
|
// Initialize
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
addMobileTouchFeedback();
|
|
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);
|
|
|
|
setInterval(() => {
|
|
const streams = document.querySelectorAll('.stream-img');
|
|
streams.forEach(stream => {
|
|
if (stream.complete && stream.naturalHeight === 0) {
|
|
stream.src = stream.src.split('?')[0] + '?refresh=' + Date.now();
|
|
}
|
|
});
|
|
}, 30000);
|
|
|
|
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> |