This repository was archived by the owner on Oct 24, 2026. It is now read-only.
Repository navigation
docs: replace Arcade embeds with self-hosted videos #758
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
02486f4
docs: replace Arcade embeds with self-hosted videos
AbhishekDoshi26 30f4d0a
docs: cover the API key in the video and fix DemoVideo layout
AbhishekDoshi26 87aa2e9
docs: keep videos out of the middleware and load them on play
AbhishekDoshi26 b685be2
docs: resolve DemoVideo files from publicDir and drop videos from llm…
AbhishekDoshi26 e64ba94
docs: build each DemoVideo public path once
AbhishekDoshi26 06b88f7
docs: sentence-case the video titles and validate DemoVideo names
AbhishekDoshi26 779b062
docs: keep /videos/* out of the Pages Function and revert stray title…
AbhishekDoshi26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "version": 1, | ||
| "include": ["/*"], | ||
| "exclude": ["/videos/*"] | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
|
AbhishekDoshi26 marked this conversation as resolved.
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
|
AbhishekDoshi26 marked this conversation as resolved.
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
|
AbhishekDoshi26 marked this conversation as resolved.
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
|
AbhishekDoshi26 marked this conversation as resolved.
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| import { existsSync } from 'node:fs'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { publicDir } from 'astro:config/server'; | ||
| import sharp from 'sharp'; | ||
|
|
||
| interface Props { | ||
| /** File name (without extension) of the video in `public/videos/`. */ | ||
| name: string; | ||
| title: string; | ||
| } | ||
|
|
||
| const { name, title } = Astro.props; | ||
|
|
||
| // Keep `name` URL-safe so the file checked below is the one that's served. | ||
| if (!/^[a-z0-9-]+$/.test(name)) { | ||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
| throw new Error(`DemoVideo: name "${name}" must be lowercase kebab-case`); | ||
| } | ||
|
|
||
| const src = `/videos/${name}.mp4`; | ||
| const poster = `/videos/${name}.jpg`; | ||
|
|
||
| const fileIn = (file: string) => new URL(`.${file}`, publicDir); | ||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
|
|
||
| // Fail the build on a missing video or poster instead of shipping a player | ||
| // that 404s. | ||
| for (const file of [src, poster]) { | ||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
| if (!existsSync(fileIn(file))) { | ||
| throw new Error(`DemoVideo: public${file} does not exist`); | ||
| } | ||
| } | ||
|
|
||
| // The poster is a frame of the video, so its size reserves the right box | ||
| // before anything loads and the page doesn't jump. | ||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
| const { width, height } = await sharp( | ||
|
AbhishekDoshi26 marked this conversation as resolved.
AbhishekDoshi26 marked this conversation as resolved.
|
||
| fileURLToPath(fileIn(poster)), | ||
| ).metadata(); | ||
| --- | ||
|
|
||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
| <figure class="demo-video"> | ||
| <video | ||
|
AbhishekDoshi26 marked this conversation as resolved.
AbhishekDoshi26 marked this conversation as resolved.
|
||
| controls | ||
| playsinline | ||
| preload="none" | ||
| poster={poster} | ||
| width={width} | ||
| height={height} | ||
|
AbhishekDoshi26 marked this conversation as resolved.
AbhishekDoshi26 marked this conversation as resolved.
|
||
| aria-label={title} | ||
|
AbhishekDoshi26 marked this conversation as resolved.
|
||
| data-mdast="ignore" | ||
| > | ||
| <source src={src} type="video/mp4" /> | ||
| </video> | ||
| <figcaption><a href={src}>Watch the video: {title}</a></figcaption> | ||
|
AbhishekDoshi26 marked this conversation as resolved.
AbhishekDoshi26 marked this conversation as resolved.
|
||
| </figure> | ||
|
|
||
| <style> | ||
| .demo-video { | ||
| margin-inline: 0; | ||
| } | ||
|
|
||
| .demo-video video { | ||
| display: block; | ||
| width: 100%; | ||
| height: auto; | ||
| border-radius: 0.5rem; | ||
| border: 1px solid var(--sl-color-gray-5); | ||
| background-color: var(--sl-color-black); | ||
| } | ||
|
|
||
| .demo-video figcaption { | ||
| margin-top: 0.5rem; | ||
| font-size: var(--sl-text-sm); | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.