feat: add À la une feature

This commit is contained in:
2026-01-14 16:51:44 +04:00
parent 66de41b118
commit 10f0b9a6eb
6 changed files with 149 additions and 34 deletions
+30 -14
View File
@@ -105,39 +105,55 @@ setSecurityHeaders();
<section class="hero" aria-labelledby="live-section-title">
<h2 id="live-section-title" class="sr-only">Diffusion en direct</h2>
<?php
// Vérifier s'il y a un direct en cours
$liveStream = getLiveStream();
// Récupérer la vidéo à afficher selon le mode configuré
$displayData = getDisplayVideo();
$video = $displayData['video'];
$isLive = $displayData['isLive'];
$badge = $displayData['badge'];
$mode = $displayData['mode'];
if ($liveStream) {
// Afficher le direct en cours
if ($video) {
// Construire les paramètres de l'iframe selon le mode
$iframeParams = '';
if ($mode === 'auto' && $isLive) {
// Mode auto avec direct : autoplay + muted
$iframeParams = '?autoplay=1&muted=1';
}
// Mode static : pas d'autoplay (iframe params reste vide)
// Afficher la vidéo
?>
<div class="live-badge">
<i class="fas fa-circle"></i> DIRECT
<?php if ($isLive): ?>
<i class="fas fa-circle"></i> <?php echo htmlspecialchars($badge); ?>
<?php else: ?>
<?php echo htmlspecialchars($badge); ?>
<?php endif; ?>
</div>
<div class="hero-video-container">
<iframe
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $liveStream['id']; ?>?autoplay=1&muted=1"
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $video['id']; ?><?php echo $iframeParams; ?>"
frameborder="0"
allowfullscreen="allowfullscreen"
allow="autoplay; fullscreen"
title="Diffusion en direct: <?php echo htmlspecialchars($liveStream['title']); ?>"
aria-describedby="live-description">
title="<?php echo htmlspecialchars($video['title']); ?>"
aria-describedby="video-description">
</iframe>
<div id="live-description" class="sr-only">
Lecteur vidéo pour la diffusion en direct de <?php echo htmlspecialchars($liveStream['channel']); ?>
<div id="video-description" class="sr-only">
Lecteur vidéo pour <?php echo htmlspecialchars($video['title']); ?> de <?php echo htmlspecialchars($video['channel']); ?>
</div>
</div>
<div class="hero-video-info">
<h2><?php echo htmlspecialchars($liveStream['title']); ?></h2>
<h2><?php echo htmlspecialchars($video['title']); ?></h2>
<div class="hero-channel-info">
<?php if (strpos($liveStream['channelAvatar'], 'default-avatar.png') !== false || empty($liveStream['channelAvatar'])): ?>
<?php if (strpos($video['channelAvatar'], 'default-avatar.png') !== false || empty($video['channelAvatar'])): ?>
<div class="channel-avatar-placeholder" role="img" aria-label="Avatar par défaut">
<i class="fas fa-user-circle" aria-hidden="true"></i>
</div>
<?php else: ?>
<img src="<?php echo $liveStream['channelAvatar']; ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($liveStream['channel']); ?>" class="channel-avatar">
<img src="<?php echo $video['channelAvatar']; ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($video['channel']); ?>" class="channel-avatar">
<?php endif; ?>
<span class="channel-name"><?php echo htmlspecialchars($liveStream['channel']); ?></span>
<span class="channel-name"><?php echo htmlspecialchars($video['channel']); ?></span>
</div>
</div>
<?php