Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#865): BackgroundVideo.astro not playing when changing combat #866

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
233f5b9
fix(BackgroundVideo): not playing when changing combat
AlejandroSuero Apr 5, 2024
26e698c
fix: moved video into function and removed `removeEventListener()`
AlejandroSuero Apr 5, 2024
928b625
feat: added `playsinline` for iOS support
AlejandroSuero Apr 5, 2024
b81e533
fix: removed autoplay
AlejandroSuero Apr 5, 2024
ad975f1
Feature/fix background video playing (#1)
yurigo Apr 5, 2024
1f1c07c
feat: added `isFirefox` check for view transitions
AlejandroSuero Apr 5, 2024
db4e96e
fix: added autoplay
AlejandroSuero Apr 5, 2024
8d1b2ba
fix: modified according to @yurigo's changes
AlejandroSuero Apr 6, 2024
43257f0
feat: added `isFirefox` check after testing it
AlejandroSuero Apr 6, 2024
acf89fe
Merge branch 'main' into feature/fix-background-video-playing
midudev Apr 12, 2024
75272c9
Merge branch 'main' into feature/fix-background-video-playing
midudev Apr 12, 2024
96060e9
fix: removed firefox detection code
AlejandroSuero Apr 12, 2024
e4232a9
fix: added `transition:name`
AlejandroSuero Apr 12, 2024
b1143c4
Merge branch 'main' into feature/fix-background-video-playing
AlejandroSuero Apr 23, 2024
077c5c2
fix(BackgroundVideo): modified to use `@/lib/dom-selector`
AlejandroSuero May 1, 2024
2f5ab0d
Merge branch 'main' into feature/fix-background-video-playing
AlejandroSuero May 1, 2024
c251dec
Merge branch 'main' into feature/fix-background-video-playing
midudev May 14, 2024
73964a3
Merge branch 'main' into feature/fix-background-video-playing
AlejandroSuero May 14, 2024
4b3cae1
Merge branch 'midudev:main' into feature/fix-background-video-playing
AlejandroSuero May 16, 2024
3c7722d
Merge branch 'main' into feature/fix-background-video-playing
midudev May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/components/Combates/BackgroundVideo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,28 @@ interface Props {
}

const { id } = Astro.props

const url = `https://cdn.lavelada.dev/${id}-corto.mp4`
---

<div class="fixed left-0 top-0 -z-10 aspect-video h-[100vh] w-screen" id="bg-video">
<video
id="video-player"
autoplay
muted
loop
class="aspect-video size-full overflow-hidden object-cover opacity-0 transition-opacity duration-500"
style="mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 70%, transparent);"
oncanplay="this.classList.add('opacity-70')"
playsinline
src={url}
>
<source type="video/mp4" src={`https://cdn.lavelada.dev/${id}-corto.mp4`} />
<source type="video/mp4" src={url} />
</video>
</div>

<script>
<script is:inline>
import { $ } from "@/lib/dom-selector"

const $bgVideoDiv = $("#bg-video")

const playVideo = () => {
if ($bgVideoDiv) $bgVideoDiv.querySelector("video")?.play()
else document.removeEventListener("astro:page-load", playVideo)
}

document.addEventListener("astro:page-load", playVideo)
$("#video-player").load()
</script>
2 changes: 1 addition & 1 deletion src/pages/combates/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const prerender = true
<Image
width={combatData.titleSize[0]}
height={combatData.titleSize[1]}
transition:name={`title-image-${combat.id}`}
AlejandroSuero marked this conversation as resolved.
Show resolved Hide resolved
transition:name={`title-image-${combatData.id}`}
loading={index < 2 ? "eager" : "lazy"}
class:list={[
"group-hover:saturate-15 absolute left-1/2 h-auto max-h-[15rem] w-auto -translate-x-1/2 transform-gpu transition-all duration-300 ease-in-out group-hover:scale-75",
Expand Down
Loading