Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ Available in **French** and **English**.
| [Neon](https://neon.tech/) | PostgreSQL database |
| [Bunny CDN](https://bunny.net/) | Video storage and HLS delivery |
| [Stripe](https://stripe.com/) | Payment processing and subscriptions |
| [Algolia](https://www.algolia.com/) | Search indexing |
| [Algolia](https://www.algolia.com/) | Search indexing and analytics |
| [Resend](https://resend.com/) | Transactional emails |
| [Algolia](https://www.algolia.com/) | Search and analytics |

## Prerequisites

Expand Down
31 changes: 31 additions & 0 deletions e2e/embed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const IN_ENGLISH = { locale: E2E_ENGLISH_LOCALE } as const satisfies {
locale: Locale
}
const BANNER_GRACE_MS = 1000
const HLS_PLAYER_CHUNK_PATTERN = /\/hls\.light-[\w-]+\.js$/u

test.describe('the embed player', () => {
test('lets any site frame it and stays out of the index', async ({
Expand Down Expand Up @@ -52,6 +53,36 @@ test.describe('the embed player', () => {
.toBeGreaterThan(0)
})

test('plays the Video when Play comes before the player has loaded', async ({
page
}) => {
const { promise: playPressed, resolve: releasePlayer } =
Promise.withResolvers<null>()

await page.route(HLS_PLAYER_CHUNK_PATTERN, async (route) => {
await playPressed
await route.fallback()
})
await page.goto(EMBED_PATHNAME)

const video = page.getByTestId('meme-video')

await repeatUntilVisible(
() => {
return page
.getByRole('button', { name: m.meme_play_video(), exact: true })
.click()
},
page.getByRole('button', { name: m.meme_pause_video(), exact: true })
)
releasePlayer(null)
await expect
.poll(() => {
return readVideoCurrentTime(video)
})
.toBeGreaterThan(0)
})

test('leads back to the Meme page in a new tab', async ({ page }) => {
await page.goto(EMBED_PATHNAME)

Expand Down
1 change: 1 addition & 0 deletions src/lib/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const PRELOADS_LOADING_ON_PLAY = new Set(['none', 'metadata'])

const matchIsLoadingOnPlay = (video: HTMLVideoElement) => {
return (
video.paused &&
!bufferingByVideo.has(video) &&
PRELOADS_LOADING_ON_PLAY.has(video.getAttribute('preload') ?? '')
)
Expand Down
Loading