Skip to content

Commit 83c03ee

Browse files
committed
Remove loop on video
1 parent 2c9d8a8 commit 83c03ee

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

docs/index.html

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ <h1><span class="open-source" data-i18n-key="h1_1">Open Source</span> <span data
6565
<a href="https://studio.linto.app/" class="btn" data-i18n-key="start_free">Start Free</a>
6666
<a href="https://github.com/linto-ai" class="btn btn--outline" data-i18n-key="github">Github <span class="icon github" /></a>
6767
</div>
68-
<div class="screenshot" @click="document.getElementById('video').play(); document.getElementById('playButton').style.display='none';">
69-
<video id="video" playsinline muted loop src="/demo linto.mp4" poster="/screenshot.png"></video>
68+
<div class="screenshot">
69+
<video id="video" playsinline muted src="/demo linto.mp4" poster="/screenshot.png"></video>
7070

71-
<button class="play-button" onclick="document.getElementById('video').play(); this.style.display='none';" id="playButton">
71+
<button class="play-button" id="playButton">
7272
<span class="icon play" />
7373
</button>
7474
<!-- <img src="/screenshot.png" alt="LinTO Studio Screenshot" /> -->
@@ -249,6 +249,30 @@ <h3 data-i18n-key="pricing_premium_title">Premium</h3>
249249
setInterval(wink, 10000);
250250
}, 1000);
251251
}
252+
253+
const video = document.getElementById('video');
254+
const playButton = document.getElementById('playButton');
255+
const screenshot = document.querySelector('.screenshot');
256+
257+
video.playbackRate = 0.75;
258+
259+
const playVideo = () => {
260+
video.play();
261+
playButton.style.display = 'none';
262+
screenshot.classList.add('playing');
263+
};
264+
265+
playButton.addEventListener('click', (e) => {
266+
e.stopPropagation();
267+
playVideo();
268+
});
269+
screenshot.addEventListener('click', playVideo);
270+
271+
video.addEventListener('ended', () => {
272+
playButton.style.display = 'flex';
273+
screenshot.classList.remove('playing');
274+
video.load(); // Resets to poster
275+
});
252276
});
253277
</script>
254278
</body>

docs/style.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ section {
366366
width: 100%;
367367
height: auto;
368368
display: block;
369+
transition: filter 0.3s ease-in-out;
370+
}
371+
372+
.screenshot:not(.playing):hover video {
373+
filter: blur(4px);
369374
}
370375

371376
.play-button {
@@ -384,7 +389,8 @@ section {
384389
color: var(--color-primary);
385390
background-color: var(--color-primary);
386391
border: 2px solid var(--color-text);
387-
transition: background-color 0.3s, transform 0.3s;
392+
transition: background-color 0.3s, transform 0.3s, opacity 0.3s;
393+
opacity: 0;
388394

389395
&:hover {
390396
background-color: var(--color-primary-dark);
@@ -393,6 +399,10 @@ section {
393399
}
394400
}
395401

402+
.screenshot:not(.playing):hover .play-button {
403+
opacity: 1;
404+
}
405+
396406
.buttons {
397407
margin-top: 2em;
398408
display: flex;

0 commit comments

Comments
 (0)