2025-10-17 12:26:49 +04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2025-10-17 14:23:31 +04:00
|
|
|
* Section Hero - Affichage conditionnel (Direct / Playlist / Vidéo / Rien)
|
2025-10-17 12:26:49 +04:00
|
|
|
*
|
|
|
|
|
* Ce fichier gère l'affichage de la section hero en fonction de la configuration:
|
|
|
|
|
* - HERO_TYPE = 'live': Affiche le direct PeerTube
|
2025-10-17 14:23:31 +04:00
|
|
|
* - HERO_TYPE = 'video': Affiche une vidéo PeerTube unique
|
2025-10-17 12:26:49 +04:00
|
|
|
* - HERO_TYPE = 'playlist': Affiche une playlist (PeerTube/Funkwhale/Castopod)
|
|
|
|
|
* - HERO_TYPE = 'none': N'affiche rien
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Type de hero défini dans config
|
|
|
|
|
$heroType = defined('HERO_TYPE') ? HERO_TYPE : 'live';
|
|
|
|
|
|
|
|
|
|
// Si le type est 'none', ne rien afficher
|
|
|
|
|
if ($heroType === 'none') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<section class="hero" aria-labelledby="hero-section-title">
|
|
|
|
|
<h2 id="hero-section-title" class="sr-only">
|
2025-10-17 14:23:31 +04:00
|
|
|
<?php
|
|
|
|
|
if ($heroType === 'live') {
|
|
|
|
|
echo 'Diffusion en direct';
|
|
|
|
|
} elseif ($heroType === 'video') {
|
|
|
|
|
echo 'Vidéo';
|
|
|
|
|
} else {
|
|
|
|
|
echo 'Playlist';
|
|
|
|
|
}
|
|
|
|
|
?>
|
2025-10-17 12:26:49 +04:00
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
<?php if ($heroType === 'live'): ?>
|
|
|
|
|
<!-- Mode DIRECT -->
|
|
|
|
|
<?php
|
|
|
|
|
// Vérifier s'il y a un direct en cours
|
|
|
|
|
$liveStream = getLiveStream();
|
|
|
|
|
|
|
|
|
|
if ($liveStream) {
|
|
|
|
|
// Afficher le direct en cours
|
|
|
|
|
?>
|
|
|
|
|
<div class="live-badge">
|
|
|
|
|
<i class="fas fa-circle"></i> DIRECT
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hero-video-container">
|
|
|
|
|
<iframe
|
2026-07-27 01:54:42 +04:00
|
|
|
src="<?php echo e(PEERTUBE_URL . '/videos/embed/' . $liveStream['id'] . '?autoplay=1&muted=1'); ?>"
|
2025-10-17 12:26:49 +04:00
|
|
|
frameborder="0"
|
|
|
|
|
allowfullscreen="allowfullscreen"
|
|
|
|
|
allow="autoplay; fullscreen"
|
|
|
|
|
title="Diffusion en direct: <?php echo htmlspecialchars($liveStream['title']); ?>"
|
|
|
|
|
aria-describedby="live-description">
|
|
|
|
|
</iframe>
|
|
|
|
|
<div id="live-description" class="sr-only">
|
|
|
|
|
Lecteur vidéo pour la diffusion en direct de <?php echo htmlspecialchars($liveStream['channel']); ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hero-video-info">
|
|
|
|
|
<h2><?php echo htmlspecialchars($liveStream['title']); ?></h2>
|
|
|
|
|
<div class="hero-channel-info">
|
|
|
|
|
<?php if (strpos($liveStream['channelAvatar'], 'default-avatar.png') !== false || empty($liveStream['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: ?>
|
2026-07-27 01:54:42 +04:00
|
|
|
<img src="<?php echo e($liveStream['channelAvatar']); ?>" alt="Avatar de la chaîne <?php echo htmlspecialchars($liveStream['channel']); ?>" class="channel-avatar">
|
2025-10-17 12:26:49 +04:00
|
|
|
<?php endif; ?>
|
|
|
|
|
<span class="channel-name"><?php echo htmlspecialchars($liveStream['channel']); ?></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
} else {
|
|
|
|
|
// Aucun direct en cours - vérifier s'il y a une annonce configurée
|
|
|
|
|
$showNextLiveAnnouncement = defined('NEXT_LIVE_ENABLED') && NEXT_LIVE_ENABLED === true;
|
|
|
|
|
|
|
|
|
|
if ($showNextLiveAnnouncement) {
|
2026-07-27 09:15:38 +04:00
|
|
|
// Afficher l'annonce du prochain live (partial partagé avec direct.php)
|
|
|
|
|
$nextLiveVariant = 'hero';
|
|
|
|
|
include __DIR__ . '/partials/next-live.php';
|
2025-10-17 12:26:49 +04:00
|
|
|
} else {
|
|
|
|
|
?>
|
|
|
|
|
<div class="hero-no-live">
|
|
|
|
|
<i class="fas fa-tv"></i>
|
|
|
|
|
<h2>Aucun direct en cours</h2>
|
|
|
|
|
<p>Revenez plus tard pour découvrir nos prochaines diffusions en direct.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<?php elseif ($heroType === 'playlist'): ?>
|
|
|
|
|
<!-- Mode PLAYLIST -->
|
|
|
|
|
<?php
|
|
|
|
|
$platform = defined('PLAYLIST_PLATFORM') ? PLAYLIST_PLATFORM : 'peertube';
|
|
|
|
|
$instanceUrl = defined('PLAYLIST_INSTANCE_URL') ? PLAYLIST_INSTANCE_URL : '';
|
|
|
|
|
$playlistId = defined('PLAYLIST_ID') ? PLAYLIST_ID : '';
|
|
|
|
|
$playlistTitle = defined('PLAYLIST_TITLE') ? PLAYLIST_TITLE : 'Playlist';
|
|
|
|
|
$playlistDescription = defined('PLAYLIST_DESCRIPTION') ? PLAYLIST_DESCRIPTION : '';
|
|
|
|
|
|
|
|
|
|
if (!empty($instanceUrl) && !empty($playlistId)):
|
|
|
|
|
?>
|
|
|
|
|
<div class="hero-playlist">
|
|
|
|
|
<div class="hero-playlist-header">
|
|
|
|
|
<i class="fas fa-list-music"></i>
|
|
|
|
|
<div class="hero-playlist-info">
|
|
|
|
|
<h2><?php echo htmlspecialchars($playlistTitle); ?></h2>
|
|
|
|
|
<?php if (!empty($playlistDescription)): ?>
|
|
|
|
|
<p><?php echo htmlspecialchars($playlistDescription); ?></p>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="hero-playlist-container">
|
|
|
|
|
<?php if ($platform === 'peertube'): ?>
|
|
|
|
|
<!-- Embed PeerTube Playlist -->
|
|
|
|
|
<iframe
|
|
|
|
|
src="<?php echo rtrim($instanceUrl, '/'); ?>/video-playlists/embed/<?php echo $playlistId; ?>"
|
|
|
|
|
frameborder="0"
|
|
|
|
|
allowfullscreen="allowfullscreen"
|
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
|
|
|
|
|
title="<?php echo htmlspecialchars($playlistTitle); ?>">
|
|
|
|
|
</iframe>
|
|
|
|
|
|
|
|
|
|
<?php elseif ($platform === 'funkwhale'): ?>
|
|
|
|
|
<!-- Embed Funkwhale Playlist -->
|
|
|
|
|
<iframe
|
|
|
|
|
src="<?php echo rtrim($instanceUrl, '/'); ?>/front/embed.html?&type=playlist&id=<?php echo $playlistId; ?>"
|
|
|
|
|
frameborder="0"
|
|
|
|
|
allowfullscreen="allowfullscreen"
|
|
|
|
|
title="<?php echo htmlspecialchars($playlistTitle); ?>">
|
|
|
|
|
</iframe>
|
|
|
|
|
|
|
|
|
|
<?php elseif ($platform === 'castopod'): ?>
|
|
|
|
|
<!-- Embed Castopod Podcast -->
|
|
|
|
|
<iframe
|
|
|
|
|
src="<?php echo rtrim($instanceUrl, '/'); ?>/<?php echo $playlistId; ?>/embed/dark"
|
|
|
|
|
frameborder="0"
|
|
|
|
|
allowfullscreen="allowfullscreen"
|
|
|
|
|
title="<?php echo htmlspecialchars($playlistTitle); ?>">
|
|
|
|
|
</iframe>
|
|
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="hero-playlist-footer">
|
|
|
|
|
<a href="<?php
|
|
|
|
|
if ($platform === 'peertube') {
|
|
|
|
|
echo rtrim($instanceUrl, '/') . '/w/p/' . $playlistId;
|
|
|
|
|
} elseif ($platform === 'funkwhale') {
|
|
|
|
|
echo rtrim($instanceUrl, '/') . '/library/playlists/' . $playlistId;
|
|
|
|
|
} elseif ($platform === 'castopod') {
|
|
|
|
|
echo rtrim($instanceUrl, '/') . '/' . $playlistId;
|
|
|
|
|
}
|
|
|
|
|
?>" target="_blank" rel="noopener noreferrer" class="hero-playlist-link">
|
|
|
|
|
<i class="fas fa-external-link-alt"></i>
|
|
|
|
|
Voir sur <?php echo ucfirst($platform); ?>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="hero-no-live">
|
|
|
|
|
<i class="fas fa-list-music"></i>
|
|
|
|
|
<h2>Playlist non configurée</h2>
|
|
|
|
|
<p>Configurez PLAYLIST_INSTANCE_URL et PLAYLIST_ID dans votre fichier de configuration.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
2025-10-17 14:23:31 +04:00
|
|
|
<?php elseif ($heroType === 'video'): ?>
|
|
|
|
|
<!-- Mode VIDÉO -->
|
|
|
|
|
<?php
|
|
|
|
|
$videoId = defined('HERO_VIDEO_ID') ? HERO_VIDEO_ID : '';
|
|
|
|
|
$videoTitle = defined('HERO_VIDEO_TITLE') ? HERO_VIDEO_TITLE : 'Vidéo de présentation';
|
|
|
|
|
|
|
|
|
|
if (!empty($videoId)):
|
|
|
|
|
?>
|
|
|
|
|
<div class="hero-video-container">
|
|
|
|
|
<iframe
|
|
|
|
|
src="<?php echo PEERTUBE_URL; ?>/videos/embed/<?php echo $videoId; ?>"
|
|
|
|
|
frameborder="0"
|
|
|
|
|
allowfullscreen="allowfullscreen"
|
|
|
|
|
sandbox="allow-same-origin allow-scripts allow-popups"
|
|
|
|
|
allow="autoplay; fullscreen"
|
|
|
|
|
title="<?php echo htmlspecialchars($videoTitle); ?>">
|
|
|
|
|
</iframe>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="hero-no-live">
|
|
|
|
|
<i class="fas fa-video"></i>
|
|
|
|
|
<h2>Vidéo non configurée</h2>
|
|
|
|
|
<p>Configurez HERO_VIDEO_ID dans votre fichier de configuration.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
2025-10-17 12:26:49 +04:00
|
|
|
<?php endif; ?>
|
|
|
|
|
</section>
|