2025-06-21 18:01:24 +00:00
|
|
|
<section class="section">
|
|
|
|
|
<div class="container">
|
2025-06-21 18:30:58 +00:00
|
|
|
<div class="box">
|
2025-06-21 18:36:57 +00:00
|
|
|
|
2025-06-21 18:11:03 +00:00
|
|
|
<!-- Bloc détail -->
|
2025-06-21 18:05:03 +00:00
|
|
|
<div id="detail-block">
|
|
|
|
|
<div class="columns is-vcentered">
|
|
|
|
|
<div class="column is-one-third">
|
|
|
|
|
<figure class="image is-3by4">
|
|
|
|
|
<img src="{{.item.ThumbURL}}" alt="{{.item.Title}}" />
|
|
|
|
|
</figure>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="column">
|
|
|
|
|
<h1 class="title">{{.item.Title}}</h1>
|
2025-06-21 18:07:31 +00:00
|
|
|
{{with .item.Summary}}<p class="content">{{.}}</p>{{end}}
|
|
|
|
|
{{with .item.DurationFmt}}<p class="subtitle is-6">Durée : {{.}}</p>{{end}}
|
2025-06-21 18:11:03 +00:00
|
|
|
<button class="button is-primary js-play-btn" data-hlsurl="{{.item.HLSURL}}">
|
2025-06-21 18:05:03 +00:00
|
|
|
<span class="icon"><i class="fas fa-play"></i></span>
|
|
|
|
|
<span>Play</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-06-21 18:01:24 +00:00
|
|
|
</div>
|
2025-06-21 18:05:03 +00:00
|
|
|
</div>
|
2025-06-21 18:07:31 +00:00
|
|
|
|
2025-06-21 18:11:03 +00:00
|
|
|
<!-- Bloc player -->
|
|
|
|
|
<div class="box js-player-block" style="display:none;">
|
|
|
|
|
<video id="hls-video" controls autoplay style="width:100%; height:auto;"></video>
|
|
|
|
|
<button class="button is-light mt-4 js-close-btn">
|
|
|
|
|
<span class="icon"><i class="fas fa-times"></i></span>
|
|
|
|
|
<span>Fermer</span>
|
|
|
|
|
</button>
|
2025-06-21 18:01:24 +00:00
|
|
|
</div>
|
2025-06-21 18:07:31 +00:00
|
|
|
|
2025-06-21 18:01:24 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
2025-06-21 18:12:59 +00:00
|
|
|
<script>
|
2025-06-21 18:36:57 +00:00
|
|
|
document.body.addEventListener('click', function(e) {
|
|
|
|
|
// Play
|
|
|
|
|
const playBtn = e.target.closest('.js-play-btn');
|
|
|
|
|
if (playBtn) {
|
|
|
|
|
const detailBlock = document.getElementById('detail-block');
|
|
|
|
|
const playerBlock = document.querySelector('.js-player-block');
|
|
|
|
|
const video = document.getElementById('hls-video');
|
|
|
|
|
const url = playBtn.dataset.hlsurl;
|
2025-06-21 18:12:59 +00:00
|
|
|
|
2025-06-21 18:36:57 +00:00
|
|
|
detailBlock.style.display = 'none';
|
|
|
|
|
playerBlock.style.display = 'block';
|
2025-06-21 18:12:59 +00:00
|
|
|
|
2025-06-21 18:36:57 +00:00
|
|
|
if (Hls.isSupported()) {
|
|
|
|
|
const hls = new Hls();
|
|
|
|
|
hls.loadSource(url);
|
|
|
|
|
hls.attachMedia(video);
|
|
|
|
|
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
|
|
|
video.src = url;
|
|
|
|
|
} else {
|
|
|
|
|
console.error('HLS non supporté');
|
2025-06-21 18:30:58 +00:00
|
|
|
}
|
2025-06-21 18:36:57 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2025-06-21 18:12:59 +00:00
|
|
|
|
2025-06-21 18:36:57 +00:00
|
|
|
// Fermer
|
|
|
|
|
const closeBtn = e.target.closest('.js-close-btn');
|
|
|
|
|
if (closeBtn) {
|
|
|
|
|
const detailBlock = document.getElementById('detail-block');
|
|
|
|
|
const playerBlock = document.querySelector('.js-player-block');
|
|
|
|
|
const video = document.getElementById('hls-video');
|
|
|
|
|
|
|
|
|
|
video.pause();
|
|
|
|
|
video.src = '';
|
|
|
|
|
playerBlock.style.display = 'none';
|
|
|
|
|
detailBlock.style.display = 'block';
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-06-21 18:12:59 +00:00
|
|
|
|
|
|
|
|
</script>
|