From b5a7856fba6945cdc5bbd1cdc471d48609cb43b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:44:13 +0000 Subject: [PATCH 1/5] Initial plan From b66610c3b671e2619087bdaf745de7483ef5fbae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:53:21 +0000 Subject: [PATCH 2/5] Add Video component for Astro Starlight documentation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- docs/astro.config.mjs | 1 + docs/public/videos/README.md | 47 +++++++++ docs/src/components/Video.astro | 98 +++++++++++++++++++ .../docs/examples/video-component-demo.mdx | 98 +++++++++++++++++++ 4 files changed, 244 insertions(+) create mode 100644 docs/public/videos/README.md create mode 100644 docs/src/components/Video.astro create mode 100644 docs/src/content/docs/examples/video-component-demo.mdx diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index d5c9c28c12..758daf25c8 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -214,6 +214,7 @@ export default defineConfig({ { label: 'Custom Agents', link: '/reference/copilot-custom-agents/' }, { label: 'GH-AW as MCP Server', link: '/setup/mcp-server/' }, { label: 'MCP Gateway', link: '/reference/mcp-gateway/' }, + { label: 'Video Component', link: '/examples/video-component-demo/' }, { label: 'FAQ', link: '/reference/faq/' }, ], }, diff --git a/docs/public/videos/README.md b/docs/public/videos/README.md new file mode 100644 index 0000000000..e4a8272f3e --- /dev/null +++ b/docs/public/videos/README.md @@ -0,0 +1,47 @@ +# Videos Directory + +This directory contains video files used in the documentation. + +## Usage + +Place video files here and reference them in documentation using the Video component: + +```mdx +import Video from '../../../components/Video.astro'; + + +``` + +## Supported Formats + +- MP4 (`.mp4`) - **Recommended** for best browser compatibility +- WebM (`.webm`) - Modern, open format +- OGG (`.ogg`) - Open format, older browsers +- MOV (`.mov`) - QuickTime format +- AVI (`.avi`) - Legacy format +- MKV (`.mkv`) - Matroska format + +## Best Practices + +- Keep file sizes reasonable for web delivery (< 50MB recommended) +- Use MP4 with H.264 codec for widest browser support +- Provide meaningful filenames (e.g., `workflow-demo.mp4`) +- Consider adding poster images (thumbnails) for better UX +- Compress videos appropriately for web use + +## Example + +To add a new video to the documentation: + +1. Place the video file in this directory: `docs/public/videos/demo.mp4` +2. Reference it in your MDX file: + +```mdx +import Video from '../../../components/Video.astro'; + + +``` diff --git a/docs/src/components/Video.astro b/docs/src/components/Video.astro new file mode 100644 index 0000000000..5b9077789e --- /dev/null +++ b/docs/src/components/Video.astro @@ -0,0 +1,98 @@ +--- +import * as path from "path" + +interface Props { + src: string + title?: string + width?: string | number + height?: string | number + autoplay?: boolean + loop?: boolean + muted?: boolean + controls?: boolean + poster?: string +} + +const { + src, + title, + width = "100%", + height = "auto", + autoplay = false, + loop = false, + muted = false, + controls = true, + poster +} = Astro.props + +// Determine MIME type from file extension +const ext = path.extname(src).slice(1).toLowerCase() +const mimeMap: Record = { + 'mp4': 'video/mp4', + 'webm': 'video/webm', + 'ogg': 'video/ogg', + 'mov': 'video/mp4', // MOV files typically use MP4 codec + 'avi': 'video/x-msvideo', + 'mkv': 'video/x-matroska' +} +const mime = mimeMap[ext] || `video/${ext}` +--- + + + + + Your browser does not support the video element. + + {title && ( + + {title} + + )} + + + diff --git a/docs/src/content/docs/examples/video-component-demo.mdx b/docs/src/content/docs/examples/video-component-demo.mdx new file mode 100644 index 0000000000..c8b8cf8ebe --- /dev/null +++ b/docs/src/content/docs/examples/video-component-demo.mdx @@ -0,0 +1,98 @@ +--- +title: Video Component Demo +description: Example usage of the Video component for embedding videos in documentation +--- + +import Video from '../../../components/Video.astro'; + +## Video Component Usage + +The Video component makes it easy to embed video files hosted in the `public` folder. + +### Basic Usage + +To embed a video with default settings: + +```mdx +import Video from '../../../components/Video.astro'; + + +``` + +### With Title and Custom Dimensions + +```mdx + +``` + +### Autoplay and Loop + +```mdx + +``` + +### With Poster Image + +```mdx + +``` + +## Props + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `src` | `string` | *required* | Path to the video file (relative to public folder) | +| `title` | `string` | `undefined` | Video title (displayed as caption) | +| `width` | `string \| number` | `"100%"` | Video width | +| `height` | `string \| number` | `"auto"` | Video height | +| `controls` | `boolean` | `true` | Show video controls | +| `autoplay` | `boolean` | `false` | Auto-play video on load | +| `loop` | `boolean` | `false` | Loop video playback | +| `muted` | `boolean` | `false` | Mute video audio | +| `poster` | `string` | `undefined` | Poster image displayed before playback | + +## Supported Formats + +The component automatically detects the MIME type from the file extension and supports: + +- **MP4** (`.mp4`) - Recommended for best browser compatibility +- **WebM** (`.webm`) - Modern, open format +- **OGG** (`.ogg`) - Open format, older browsers +- **MOV** (`.mov`) - QuickTime format +- **AVI** (`.avi`) - Legacy format +- **MKV** (`.mkv`) - Matroska format + +## Implementation + +The Video component is based on the AudioPlayer component from the [Microsoft/genaiscript](https://github.com/microsoft/genaiscript) repository. It uses native HTML5 `` elements with accessibility features and responsive styling. + +### Features + +- 🎬 **Multiple format support** - Automatically detects MIME type from file extension +- 📱 **Responsive design** - Scales to fit container width +- 🎨 **Theme-aware styling** - Matches light/dark themes +- ♿ **Accessible** - Includes proper semantic HTML and ARIA labels +- 🎛️ **Customizable** - Full control over video attributes +- 🖼️ **Poster support** - Display thumbnail before playback + +## Tips + +- Place video files in `docs/public/videos/` directory +- Use MP4 format for best browser compatibility +- Keep file sizes reasonable for web delivery +- Provide meaningful titles for accessibility +- Use poster images to reduce initial load time From 32b35b78ce2cce74069e66dde786a0315551d08b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:55:06 +0000 Subject: [PATCH 3/5] Add comprehensive Video component documentation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- docs/astro.config.mjs | 2 +- .../docs/examples/video-component-demo.mdx | 98 ----------- .../docs/reference/video-component.mdx | 157 ++++++++++++++++++ 3 files changed, 158 insertions(+), 99 deletions(-) delete mode 100644 docs/src/content/docs/examples/video-component-demo.mdx create mode 100644 docs/src/content/docs/reference/video-component.mdx diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 758daf25c8..3e54b1eb93 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -214,7 +214,7 @@ export default defineConfig({ { label: 'Custom Agents', link: '/reference/copilot-custom-agents/' }, { label: 'GH-AW as MCP Server', link: '/setup/mcp-server/' }, { label: 'MCP Gateway', link: '/reference/mcp-gateway/' }, - { label: 'Video Component', link: '/examples/video-component-demo/' }, + { label: 'Video Component', link: '/reference/video-component/' }, { label: 'FAQ', link: '/reference/faq/' }, ], }, diff --git a/docs/src/content/docs/examples/video-component-demo.mdx b/docs/src/content/docs/examples/video-component-demo.mdx deleted file mode 100644 index c8b8cf8ebe..0000000000 --- a/docs/src/content/docs/examples/video-component-demo.mdx +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Video Component Demo -description: Example usage of the Video component for embedding videos in documentation ---- - -import Video from '../../../components/Video.astro'; - -## Video Component Usage - -The Video component makes it easy to embed video files hosted in the `public` folder. - -### Basic Usage - -To embed a video with default settings: - -```mdx -import Video from '../../../components/Video.astro'; - - -``` - -### With Title and Custom Dimensions - -```mdx - -``` - -### Autoplay and Loop - -```mdx - -``` - -### With Poster Image - -```mdx - -``` - -## Props - -| Prop | Type | Default | Description | -|------|------|---------|-------------| -| `src` | `string` | *required* | Path to the video file (relative to public folder) | -| `title` | `string` | `undefined` | Video title (displayed as caption) | -| `width` | `string \| number` | `"100%"` | Video width | -| `height` | `string \| number` | `"auto"` | Video height | -| `controls` | `boolean` | `true` | Show video controls | -| `autoplay` | `boolean` | `false` | Auto-play video on load | -| `loop` | `boolean` | `false` | Loop video playback | -| `muted` | `boolean` | `false` | Mute video audio | -| `poster` | `string` | `undefined` | Poster image displayed before playback | - -## Supported Formats - -The component automatically detects the MIME type from the file extension and supports: - -- **MP4** (`.mp4`) - Recommended for best browser compatibility -- **WebM** (`.webm`) - Modern, open format -- **OGG** (`.ogg`) - Open format, older browsers -- **MOV** (`.mov`) - QuickTime format -- **AVI** (`.avi`) - Legacy format -- **MKV** (`.mkv`) - Matroska format - -## Implementation - -The Video component is based on the AudioPlayer component from the [Microsoft/genaiscript](https://github.com/microsoft/genaiscript) repository. It uses native HTML5 `` elements with accessibility features and responsive styling. - -### Features - -- 🎬 **Multiple format support** - Automatically detects MIME type from file extension -- 📱 **Responsive design** - Scales to fit container width -- 🎨 **Theme-aware styling** - Matches light/dark themes -- ♿ **Accessible** - Includes proper semantic HTML and ARIA labels -- 🎛️ **Customizable** - Full control over video attributes -- 🖼️ **Poster support** - Display thumbnail before playback - -## Tips - -- Place video files in `docs/public/videos/` directory -- Use MP4 format for best browser compatibility -- Keep file sizes reasonable for web delivery -- Provide meaningful titles for accessibility -- Use poster images to reduce initial load time diff --git a/docs/src/content/docs/reference/video-component.mdx b/docs/src/content/docs/reference/video-component.mdx new file mode 100644 index 0000000000..7fa646f96b --- /dev/null +++ b/docs/src/content/docs/reference/video-component.mdx @@ -0,0 +1,157 @@ +--- +title: Video Component +description: Embed video files in your documentation using the Video component +sidebar: + order: 50 +--- + +import Video from '../../../components/Video.astro'; + +## Overview + +The Video component makes it easy to embed video files hosted in the `public/videos` folder into your documentation pages. + +## Basic Usage + +Import the component and use it with the `src` prop pointing to your video file: + +```mdx +import Video from '../../../components/Video.astro'; + + +``` + +## Props + +| Prop | Type | Default | Description | +|------|------|---------|-------------| +| `src` | `string` | *required* | Path to the video file (relative to public folder) | +| `title` | `string` | `undefined` | Video title (displayed as caption below video) | +| `width` | `string \| number` | `"100%"` | Video width (CSS value or number in pixels) | +| `height` | `string \| number` | `"auto"` | Video height (CSS value or number in pixels) | +| `controls` | `boolean` | `true` | Show video playback controls | +| `autoplay` | `boolean` | `false` | Auto-play video on page load | +| `loop` | `boolean` | `false` | Loop video playback | +| `muted` | `boolean` | `false` | Mute video audio by default | +| `poster` | `string` | `undefined` | Poster image URL displayed before playback | + +## Examples + +### Video with Title + +```mdx + +``` + +### Custom Dimensions + +```mdx + +``` + +### Autoplay with Loop + +```mdx + +``` + +Note: Most browsers require `muted={true}` for autoplay to work due to autoplay policies. + +### With Poster Image + +```mdx + +``` + +## Supported Video Formats + +The component automatically detects the MIME type from the file extension and supports: + +- **MP4** (`.mp4`) - **Recommended** - Best browser compatibility with H.264 codec +- **WebM** (`.webm`) - Modern, open format with VP8/VP9 codec +- **OGG** (`.ogg`) - Open format, older browser support +- **MOV** (`.mov`) - QuickTime format (uses MP4 MIME type) +- **AVI** (`.avi`) - Legacy format (limited browser support) +- **MKV** (`.mkv`) - Matroska format (limited browser support) + +For best cross-browser compatibility, use MP4 format with H.264 video codec and AAC audio codec. + +## Adding Video Files + +1. Place your video file in the `docs/public/videos/` directory +2. Reference it using the path `/gh-aw/videos/filename.mp4` +3. Import and use the Video component in your MDX page + +Example directory structure: +``` +docs/ +├── public/ +│ └── videos/ +│ ├── demo.mp4 +│ ├── tutorial.webm +│ └── README.md +└── src/ + └── content/ + └── docs/ + └── your-page.mdx +``` + +## Best Practices + +- **File Size**: Keep videos under 50MB for reasonable load times +- **Format**: Use MP4 with H.264 codec for widest browser support +- **Compression**: Compress videos appropriately for web delivery +- **Poster Images**: Provide poster images to improve perceived performance +- **Accessibility**: Always include meaningful titles for screen readers +- **Autoplay**: Avoid autoplay unless the video is muted and serves a decorative purpose + +## Implementation Details + +This component is based on the AudioPlayer component from the [Microsoft/genaiscript](https://github.com/microsoft/genaiscript) repository. It uses: + +- Native HTML5 `` element +- Semantic `` and `` markup +- Theme-aware styling for light and dark modes +- Responsive design that scales to container width +- Accessibility features including proper ARIA labels + +## Troubleshooting + +### Video doesn't play + +- Check that the file path is correct (should start with `/gh-aw/videos/`) +- Verify the video file exists in `docs/public/videos/` +- Ensure the video format is supported by the browser +- Try opening the video URL directly in the browser + +### Autoplay not working + +- Add `muted={true}` - most browsers block unmuted autoplay +- Some browsers block all autoplay - users may need to click play + +### Video quality issues + +- Check the source video resolution and bitrate +- Consider providing multiple resolutions for responsive delivery +- Use appropriate compression settings for web delivery + +## Related Components + +- [AudioPlayer](https://microsoft.github.io/genaiscript/) - Similar component for audio files (in GenAIScript docs) +- Image component - Astro's built-in `` component for optimized images From 371bd825a21115af60c47531022d2fc8e4488ac9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:57:16 +0000 Subject: [PATCH 4/5] Refactor Video component with unique implementation and updated API Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- docs/src/components/Video.astro | 198 ++++++++++++------ .../docs/reference/video-component.mdx | 103 ++++----- 2 files changed, 183 insertions(+), 118 deletions(-) diff --git a/docs/src/components/Video.astro b/docs/src/components/Video.astro index 5b9077789e..3168edcadb 100644 --- a/docs/src/components/Video.astro +++ b/docs/src/components/Video.astro @@ -1,98 +1,160 @@ --- -import * as path from "path" - interface Props { src: string - title?: string - width?: string | number - height?: string | number - autoplay?: boolean - loop?: boolean - muted?: boolean - controls?: boolean - poster?: string + caption?: string + aspectRatio?: '16:9' | '4:3' | '1:1' | 'auto' + showControls?: boolean + autoStart?: boolean + repeat?: boolean + silenced?: boolean + thumbnail?: string + maxWidth?: string } const { src, - title, - width = "100%", - height = "auto", - autoplay = false, - loop = false, - muted = false, - controls = true, - poster + caption, + aspectRatio = 'auto', + showControls = true, + autoStart = false, + repeat = false, + silenced = false, + thumbnail, + maxWidth = '100%' } = Astro.props -// Determine MIME type from file extension -const ext = path.extname(src).slice(1).toLowerCase() -const mimeMap: Record = { - 'mp4': 'video/mp4', - 'webm': 'video/webm', - 'ogg': 'video/ogg', - 'mov': 'video/mp4', // MOV files typically use MP4 codec - 'avi': 'video/x-msvideo', - 'mkv': 'video/x-matroska' +// Extract file extension and determine content type +const fileExtension = src.split('.').pop()?.toLowerCase() || '' +const videoFormats: Record = { + mp4: 'video/mp4', + webm: 'video/webm', + ogg: 'video/ogg', + ogv: 'video/ogg', + mov: 'video/quicktime', + avi: 'video/x-msvideo', + mkv: 'video/x-matroska', + m4v: 'video/x-m4v' +} +const contentType = videoFormats[fileExtension] || 'video/mp4' + +// Calculate aspect ratio padding +const ratioMap: Record = { + '16:9': '56.25%', + '4:3': '75%', + '1:1': '100%', + 'auto': '0' } -const mime = mimeMap[ext] || `video/${ext}` +const paddingBottom = ratioMap[aspectRatio] --- - - - - Your browser does not support the video element. - - {title && ( - - {title} - + + + + + Your browser doesn't support HTML5 video. Download the video here. + + + {caption && ( + + {caption} + )} - + diff --git a/docs/src/content/docs/reference/video-component.mdx b/docs/src/content/docs/reference/video-component.mdx index 7fa646f96b..4fe6303041 100644 --- a/docs/src/content/docs/reference/video-component.mdx +++ b/docs/src/content/docs/reference/video-component.mdx @@ -25,72 +25,72 @@ import Video from '../../../components/Video.astro'; | Prop | Type | Default | Description | |------|------|---------|-------------| -| `src` | `string` | *required* | Path to the video file (relative to public folder) | -| `title` | `string` | `undefined` | Video title (displayed as caption below video) | -| `width` | `string \| number` | `"100%"` | Video width (CSS value or number in pixels) | -| `height` | `string \| number` | `"auto"` | Video height (CSS value or number in pixels) | -| `controls` | `boolean` | `true` | Show video playback controls | -| `autoplay` | `boolean` | `false` | Auto-play video on page load | -| `loop` | `boolean` | `false` | Loop video playback | -| `muted` | `boolean` | `false` | Mute video audio by default | -| `poster` | `string` | `undefined` | Poster image URL displayed before playback | +| `src` | `string` | *required* | Path to the video file in the public folder | +| `caption` | `string` | `undefined` | Descriptive caption displayed below the video | +| `aspectRatio` | `'16:9' \| '4:3' \| '1:1' \| 'auto'` | `'auto'` | Maintain specific aspect ratio or auto-size | +| `showControls` | `boolean` | `true` | Display native video playback controls | +| `autoStart` | `boolean` | `false` | Begin playback automatically when loaded | +| `repeat` | `boolean` | `false` | Loop the video continuously | +| `silenced` | `boolean` | `false` | Start with audio muted | +| `thumbnail` | `string` | `undefined` | Preview image shown before playback starts | +| `maxWidth` | `string` | `'100%'` | Maximum width constraint (CSS value) | ## Examples -### Video with Title +### Video with Caption ```mdx ``` -### Custom Dimensions +### Responsive with Aspect Ratio ```mdx ``` -### Autoplay with Loop +### Autoplay Configuration ```mdx ``` -Note: Most browsers require `muted={true}` for autoplay to work due to autoplay policies. +Note: Browsers require `silenced={true}` for autoplay due to media policies. -### With Poster Image +### With Preview Thumbnail ```mdx ``` ## Supported Video Formats -The component automatically detects the MIME type from the file extension and supports: +The component recognizes file extensions and configures appropriate content types: -- **MP4** (`.mp4`) - **Recommended** - Best browser compatibility with H.264 codec -- **WebM** (`.webm`) - Modern, open format with VP8/VP9 codec -- **OGG** (`.ogg`) - Open format, older browser support -- **MOV** (`.mov`) - QuickTime format (uses MP4 MIME type) -- **AVI** (`.avi`) - Legacy format (limited browser support) -- **MKV** (`.mkv`) - Matroska format (limited browser support) +- **MP4** (`.mp4`, `.m4v`) - H.264/H.265 codec - **Recommended for compatibility** +- **WebM** (`.webm`) - VP8/VP9 codec - Excellent compression +- **OGG** (`.ogg`, `.ogv`) - Theora codec - Open source alternative +- **QuickTime** (`.mov`) - Various codecs - Apple ecosystem +- **AVI** (`.avi`) - Legacy container format +- **Matroska** (`.mkv`) - Modern container with advanced features -For best cross-browser compatibility, use MP4 format with H.264 video codec and AAC audio codec. +For maximum browser compatibility, MP4 with H.264 video and AAC audio is recommended. ## Adding Video Files @@ -114,22 +114,23 @@ docs/ ## Best Practices -- **File Size**: Keep videos under 50MB for reasonable load times -- **Format**: Use MP4 with H.264 codec for widest browser support -- **Compression**: Compress videos appropriately for web delivery -- **Poster Images**: Provide poster images to improve perceived performance -- **Accessibility**: Always include meaningful titles for screen readers -- **Autoplay**: Avoid autoplay unless the video is muted and serves a decorative purpose +- **File Size**: Optimize videos to under 50MB for reasonable loading performance +- **Encoding**: H.264 codec in MP4 container provides excellent compatibility +- **Compression**: Balance quality with file size based on content requirements +- **Thumbnails**: Use the `thumbnail` prop to show preview images +- **Captions**: Always provide descriptive `caption` text for accessibility +- **Aspect Ratios**: Use built-in ratios (`16:9`, `4:3`) for consistent sizing +- **Autoplay**: Avoid autoplay unless video is `silenced` and decorative ## Implementation Details -This component is based on the AudioPlayer component from the [Microsoft/genaiscript](https://github.com/microsoft/genaiscript) repository. It uses: +The Video component uses: -- Native HTML5 `` element -- Semantic `` and `` markup -- Theme-aware styling for light and dark modes -- Responsive design that scales to container width -- Accessibility features including proper ARIA labels +- Semantic HTML5 `` element with accessibility attributes +- CSS aspect ratio containers for responsive sizing +- Starlight theme integration for consistent light/dark mode styling +- Progressive enhancement with fallback download links +- Namespace-prefixed classes (`gh-aw-video-*`) to avoid conflicts ## Troubleshooting @@ -142,16 +143,18 @@ This component is based on the AudioPlayer component from the [Microsoft/genaisc ### Autoplay not working -- Add `muted={true}` - most browsers block unmuted autoplay -- Some browsers block all autoplay - users may need to click play +- Add `silenced={true}` - browsers block unmuted autoplay for user experience +- Some browsers require user interaction before any video plays +- Check browser console for autoplay policy messages -### Video quality issues +### Video aspect ratio incorrect -- Check the source video resolution and bitrate -- Consider providing multiple resolutions for responsive delivery -- Use appropriate compression settings for web delivery +- Specify explicit `aspectRatio` prop (`16:9`, `4:3`, `1:1`) +- Use `aspectRatio="auto"` to let video determine its own size +- Consider using `maxWidth` to constrain overly large videos ## Related Components -- [AudioPlayer](https://microsoft.github.io/genaiscript/) - Similar component for audio files (in GenAIScript docs) -- Image component - Astro's built-in `` component for optimized images +- **Image Component** - Astro's built-in optimized image handling +- **Code Blocks** - Syntax-highlighted code examples with copy functionality +- **Tabs Component** - Starlight tabs for organizing multi-format content From 44ea9374911fa8d237d575c18d94348e34df5f91 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 13:08:17 +0000 Subject: [PATCH 5/5] Address PR feedback: Remove docs page, move styles to custom.css, update imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- docs/astro.config.mjs | 1 - docs/public/videos/README.md | 10 +- docs/src/components/Video.astro | 88 ---------- .../docs/reference/video-component.mdx | 160 ------------------ docs/src/styles/custom.css | 87 ++++++++++ 5 files changed, 92 insertions(+), 254 deletions(-) delete mode 100644 docs/src/content/docs/reference/video-component.mdx diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 3e54b1eb93..d5c9c28c12 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -214,7 +214,6 @@ export default defineConfig({ { label: 'Custom Agents', link: '/reference/copilot-custom-agents/' }, { label: 'GH-AW as MCP Server', link: '/setup/mcp-server/' }, { label: 'MCP Gateway', link: '/reference/mcp-gateway/' }, - { label: 'Video Component', link: '/reference/video-component/' }, { label: 'FAQ', link: '/reference/faq/' }, ], }, diff --git a/docs/public/videos/README.md b/docs/public/videos/README.md index e4a8272f3e..2eb1af5d33 100644 --- a/docs/public/videos/README.md +++ b/docs/public/videos/README.md @@ -7,9 +7,9 @@ This directory contains video files used in the documentation. Place video files here and reference them in documentation using the Video component: ```mdx -import Video from '../../../components/Video.astro'; +import Video from '@components/Video.astro'; - + ``` ## Supported Formats @@ -37,11 +37,11 @@ To add a new video to the documentation: 2. Reference it in your MDX file: ```mdx -import Video from '../../../components/Video.astro'; +import Video from '@components/Video.astro'; ``` diff --git a/docs/src/components/Video.astro b/docs/src/components/Video.astro index 3168edcadb..ebe09e515f 100644 --- a/docs/src/components/Video.astro +++ b/docs/src/components/Video.astro @@ -70,91 +70,3 @@ const paddingBottom = ratioMap[aspectRatio] )} - - diff --git a/docs/src/content/docs/reference/video-component.mdx b/docs/src/content/docs/reference/video-component.mdx deleted file mode 100644 index 4fe6303041..0000000000 --- a/docs/src/content/docs/reference/video-component.mdx +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: Video Component -description: Embed video files in your documentation using the Video component -sidebar: - order: 50 ---- - -import Video from '../../../components/Video.astro'; - -## Overview - -The Video component makes it easy to embed video files hosted in the `public/videos` folder into your documentation pages. - -## Basic Usage - -Import the component and use it with the `src` prop pointing to your video file: - -```mdx -import Video from '../../../components/Video.astro'; - - -``` - -## Props - -| Prop | Type | Default | Description | -|------|------|---------|-------------| -| `src` | `string` | *required* | Path to the video file in the public folder | -| `caption` | `string` | `undefined` | Descriptive caption displayed below the video | -| `aspectRatio` | `'16:9' \| '4:3' \| '1:1' \| 'auto'` | `'auto'` | Maintain specific aspect ratio or auto-size | -| `showControls` | `boolean` | `true` | Display native video playback controls | -| `autoStart` | `boolean` | `false` | Begin playback automatically when loaded | -| `repeat` | `boolean` | `false` | Loop the video continuously | -| `silenced` | `boolean` | `false` | Start with audio muted | -| `thumbnail` | `string` | `undefined` | Preview image shown before playback starts | -| `maxWidth` | `string` | `'100%'` | Maximum width constraint (CSS value) | - -## Examples - -### Video with Caption - -```mdx - -``` - -### Responsive with Aspect Ratio - -```mdx - -``` - -### Autoplay Configuration - -```mdx - -``` - -Note: Browsers require `silenced={true}` for autoplay due to media policies. - -### With Preview Thumbnail - -```mdx - -``` - -## Supported Video Formats - -The component recognizes file extensions and configures appropriate content types: - -- **MP4** (`.mp4`, `.m4v`) - H.264/H.265 codec - **Recommended for compatibility** -- **WebM** (`.webm`) - VP8/VP9 codec - Excellent compression -- **OGG** (`.ogg`, `.ogv`) - Theora codec - Open source alternative -- **QuickTime** (`.mov`) - Various codecs - Apple ecosystem -- **AVI** (`.avi`) - Legacy container format -- **Matroska** (`.mkv`) - Modern container with advanced features - -For maximum browser compatibility, MP4 with H.264 video and AAC audio is recommended. - -## Adding Video Files - -1. Place your video file in the `docs/public/videos/` directory -2. Reference it using the path `/gh-aw/videos/filename.mp4` -3. Import and use the Video component in your MDX page - -Example directory structure: -``` -docs/ -├── public/ -│ └── videos/ -│ ├── demo.mp4 -│ ├── tutorial.webm -│ └── README.md -└── src/ - └── content/ - └── docs/ - └── your-page.mdx -``` - -## Best Practices - -- **File Size**: Optimize videos to under 50MB for reasonable loading performance -- **Encoding**: H.264 codec in MP4 container provides excellent compatibility -- **Compression**: Balance quality with file size based on content requirements -- **Thumbnails**: Use the `thumbnail` prop to show preview images -- **Captions**: Always provide descriptive `caption` text for accessibility -- **Aspect Ratios**: Use built-in ratios (`16:9`, `4:3`) for consistent sizing -- **Autoplay**: Avoid autoplay unless video is `silenced` and decorative - -## Implementation Details - -The Video component uses: - -- Semantic HTML5 `` element with accessibility attributes -- CSS aspect ratio containers for responsive sizing -- Starlight theme integration for consistent light/dark mode styling -- Progressive enhancement with fallback download links -- Namespace-prefixed classes (`gh-aw-video-*`) to avoid conflicts - -## Troubleshooting - -### Video doesn't play - -- Check that the file path is correct (should start with `/gh-aw/videos/`) -- Verify the video file exists in `docs/public/videos/` -- Ensure the video format is supported by the browser -- Try opening the video URL directly in the browser - -### Autoplay not working - -- Add `silenced={true}` - browsers block unmuted autoplay for user experience -- Some browsers require user interaction before any video plays -- Check browser console for autoplay policy messages - -### Video aspect ratio incorrect - -- Specify explicit `aspectRatio` prop (`16:9`, `4:3`, `1:1`) -- Use `aspectRatio="auto"` to let video determine its own size -- Consider using `maxWidth` to constrain overly large videos - -## Related Components - -- **Image Component** - Astro's built-in optimized image handling -- **Code Blocks** - Syntax-highlighted code examples with copy functionality -- **Tabs Component** - Starlight tabs for organizing multi-format content diff --git a/docs/src/styles/custom.css b/docs/src/styles/custom.css index f21ec851db..52621fcaaa 100644 --- a/docs/src/styles/custom.css +++ b/docs/src/styles/custom.css @@ -1622,3 +1622,90 @@ main, justify-content: center !important; } } + +/* Video Component Styles */ +.gh-aw-video-wrapper { + margin: 2rem auto; + width: 100%; +} + +.gh-aw-video-container { + position: relative; + width: 100%; + background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%); + border-radius: 12px; + overflow: hidden; + box-shadow: + 0 8px 16px rgba(0, 0, 0, 0.4), + 0 0 0 1px rgba(255, 255, 255, 0.05); + transition: box-shadow 0.3s ease; +} + +.gh-aw-video-container:hover { + box-shadow: + 0 12px 24px rgba(0, 0, 0, 0.5), + 0 0 0 1px rgba(139, 92, 246, 0.3); +} + +.gh-aw-video-container.has-aspect-ratio { + height: 0; + padding-bottom: 56.25%; +} + +.gh-aw-video-element { + width: 100%; + height: 100%; + display: block; + background-color: #000; +} + +.has-aspect-ratio .gh-aw-video-element { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: contain; +} + +.gh-aw-video-caption { + margin-top: 0.75rem; + padding: 0.5rem 1rem; + font-size: 0.9rem; + color: var(--sl-color-gray-3); + text-align: center; + background: var(--sl-color-gray-6); + border-left: 3px solid var(--sl-color-purple); + border-radius: 0 6px 6px 0; + font-style: italic; +} + +[data-theme='light'] .gh-aw-video-container { + background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%); + box-shadow: + 0 8px 16px rgba(0, 0, 0, 0.15), + 0 0 0 1px rgba(0, 0, 0, 0.08); +} + +[data-theme='light'] .gh-aw-video-container:hover { + box-shadow: + 0 12px 24px rgba(0, 0, 0, 0.2), + 0 0 0 1px rgba(102, 57, 186, 0.3); +} + +[data-theme='light'] .gh-aw-video-caption { + color: var(--sl-color-gray-2); + background: var(--sl-color-gray-7); +} + +@media (max-width: 768px) { + .gh-aw-video-wrapper { + margin: 1.5rem auto; + } +} + +@media (prefers-reduced-motion: reduce) { + .gh-aw-video-container { + transition: none; + } +}
Your browser doesn't support HTML5 video. Download the video here.