Files
xtremflow/web/player_mobile.html
T
MichaelandClaude Opus 5 1feeaae78a feat(design): Warm Cinema theme + event-driven adaptive players
Replaces the Projector Noir palette with "Warm Cinema" and rebuilds the
web players around a shared, event-driven engine.

Design
- app_colors: warm charcoal (#0B0908), cream (#F3E9DF), ember (#D9541F);
  adds posterScrim/heroScrim gradients, lift()/emberFocus() shadows,
  const cream-alpha tokens replacing Colors.whiteNN, and primaryFill,
  a deeper ember reserved for text-bearing fills so white labels clear
  the 4.5:1 AA threshold that #D9541F alone does not
- app_theme / mobile_theme: Fraunces (display serif) + Karla (body),
  tighter radii, 20+ component themes
- glass_container: opaque layered surfaces replace the blurred glass
- themed_loading_screen restyled; players and boot splash follow

Performance
- drop every BackdropFilter: backdrop blur forced a full framebuffer
  read per frame per card, the main source of scroll jank
- bundle Fraunces/Karla as assets so google_fonts stops fetching from
  fonts.gstatic.com at startup
- bound image decode size on 12 sites: a 40-poster grid drops from
  ~240 MB to a few tens of MB of GPU memory

Players (new shared engine: web/xf-player-core.js)
- start on media events instead of polling the buffer every 100-200 ms
- hls.js/mpegts.js loaded on demand, so ~213 KB of mpegts is never
  fetched for HLS streams
- liveSyncDurationCount 10 -> 2, startFragPrefetch on, testBandwidth
  off, MPEG-TS initial stash 512 KB -> 64 KB
- adaptive escalation fast -> balanced -> safe after repeated stalls in
  a 60 s window, applied live for HLS so there is no visible cut

Preserved from the recent streaming work on main: server-side quality
selection, stable player viewId, the turbo direct MPEG-TS path, vendored
library cache headers and the CI/Docker changes. Only the theme layer and
the player front-end were replaced; GlassCard stays in ui_components.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 21:42:56 +02:00

136 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>XtremFlow Player Mobile</title>
<link rel="stylesheet" href="xf-player.css">
<link rel="preload" href="vendor/hls.min.js" as="script">
</head>
<body>
<div id="player-container">
<!-- muted au départ : seul moyen fiable d'obtenir l'autoplay sur iOS -->
<video id="video" autoplay muted playsinline webkit-playsinline preload="auto"></video>
<div id="loading" class="xf-center">
<div class="xf-leader">
<div class="xf-leader-cross"></div>
</div>
<div class="xf-label" id="l-text">Ouverture du flux</div>
<div class="xf-hint" id="loading-hint"></div>
</div>
<button id="unmute-btn" class="xf-sound-btn" type="button">
<svg viewBox="0 0 24 24">
<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4z" />
</svg>
Activer le son
</button>
<div id="error" class="xf-center">
<div class="xf-error-mark">!</div>
<div class="xf-error-title" id="err-msg">Erreur de lecture</div>
<div class="xf-error-sub" id="err-sub">Vérifiez votre connexion</div>
</div>
</div>
<script src="xf-player-core.js"></script>
<script>
(function () {
var video = document.getElementById('video');
var loading = document.getElementById('loading');
var loadingText = document.getElementById('l-text');
var loadingHint = document.getElementById('loading-hint');
var unmuteBtn = document.getElementById('unmute-btn');
var errorBox = document.getElementById('error');
var retryCount = 0;
var maxRetries = 3;
var player = null;
function showLoading(msg) {
loading.style.display = 'block';
loadingText.textContent = msg || 'Ouverture du flux';
errorBox.style.display = 'none';
}
function hideLoading() {
loading.style.display = 'none';
loadingHint.textContent = '';
}
function showError(msg) {
hideLoading();
unmuteBtn.style.display = 'none';
errorBox.style.display = 'block';
document.getElementById('err-sub').textContent =
msg || 'Format non supporté ou lien expiré';
}
// Le geste utilisateur doit avoir lieu DANS l'iframe : iOS
// n'accepte le démutage que dans ce contexte.
unmuteBtn.addEventListener('click', function (e) {
e.preventDefault();
video.muted = false;
video.volume = 1.0;
unmuteBtn.style.display = 'none';
window.parent.postMessage({ type: 'unmuted' }, '*');
});
function buildPlayer() {
if (player) { try { player.destroy(); } catch (e) {} }
player = new XFPlayer({
video: video,
logPrefix: '[MobilePlayer]',
onLoading: showLoading,
onReady: function () {
hideLoading();
retryCount = 0;
// Tentative de démutage auto ; si iOS refuse, on propose le bouton.
if (video.muted) {
video.muted = false;
unmuteBtn.style.display = video.muted ? 'flex' : 'none';
}
},
onError: function (msg) {
if (retryCount < maxRetries) {
retryCount++;
showLoading('Reconnexion ' + retryCount + '/' + maxRetries);
setTimeout(buildPlayer, 1500);
} else {
showError(msg);
}
},
onBlocked: function () {
// Autoplay refusé même en sourdine : le bouton son sert
// aussi de déclencheur de lecture.
hideLoading();
unmuteBtn.style.display = 'flex';
},
onProfileChange: function (name) {
loadingHint.textContent =
name === 'safe' ? 'Réseau instable — buffer maximal'
: 'Réseau instable — buffer élargi';
}
});
player.start();
window.xfPlayer = player;
}
video.addEventListener('touchend', function () {
window.parent.postMessage({ type: 'user_activity' }, '*');
}, { passive: true });
buildPlayer();
})();
</script>
</body>
</html>