Skip to content

Commit

Permalink
feat: feature to autoplay videos on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
dfyz011 committed Jun 12, 2024
1 parent d0bae65 commit 0816a8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/Film.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ const { href, img, trailerGif, trailerVideo } = Astro.props;
<!-- Можно оптимизировать загрузку шрифта -->
<!-- настроить на сервере кэш -->
<Image class="static-image" loading="lazy" alt={href} src={img} />
<video class="animated-image" muted loop autoplay>
<!-- можно со звуком??? -->
<video
class="animated-image"
muted
loop
autoplay
webkit-playsinline
playsinline
>
<source
src={`/${import.meta.env.PUBLIC_TRAILER_VIDEOS_PATH}/${trailerVideo}`}
type="video/mp4"
Expand Down Expand Up @@ -69,5 +77,8 @@ const { href, img, trailerGif, trailerVideo } = Astro.props;
visibility: hidden;
object-fit: cover;
transition: opacity 0.3s ease;
@media (hover: none) {
visibility: visible;
}
}
</style>

0 comments on commit 0816a8c

Please sign in to comment.