diff --git a/site/src/components/docs/demos/seek-button/html/css/BasicUsage.astro b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.astro new file mode 100644 index 00000000..e7e95f49 --- /dev/null +++ b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.astro @@ -0,0 +1,10 @@ +--- +import HtmlDemo from '@/components/docs/demos/HtmlDemo.astro'; +import html from './BasicUsage.html?raw'; +import './BasicUsage.css'; +--- + + + diff --git a/site/src/components/docs/demos/seek-button/html/css/BasicUsage.css b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.css new file mode 100644 index 00000000..c6b605d3 --- /dev/null +++ b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.css @@ -0,0 +1,40 @@ +.seek-button-basic { + position: relative; +} + +.seek-button-basic video { + width: 100%; +} + +.seek-button-basic__buttons { + display: flex; + gap: 8px; + position: absolute; + bottom: 10px; + left: 10px; +} + +.seek-button-basic__button { + padding-block: 8px; + background: rgba(255, 255, 255, 0.7); + backdrop-filter: blur(10px); + color: black; + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 9999px; + padding-inline: 20px; + white-space: nowrap; + cursor: pointer; +} + +.seek-button-basic__button .show-when-backward { + display: none; +} +.seek-button-basic__button .show-when-forward { + display: none; +} +.seek-button-basic__button[data-direction="backward"] .show-when-backward { + display: inline; +} +.seek-button-basic__button[data-direction="forward"] .show-when-forward { + display: inline; +} diff --git a/site/src/components/docs/demos/seek-button/html/css/BasicUsage.html b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.html new file mode 100644 index 00000000..e32f1e5d --- /dev/null +++ b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.html @@ -0,0 +1,17 @@ + + + + + ⏪ 5s + + + 10s ⏩ + + + diff --git a/site/src/components/docs/demos/seek-button/html/css/BasicUsage.ts b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.ts new file mode 100644 index 00000000..3797af37 --- /dev/null +++ b/site/src/components/docs/demos/seek-button/html/css/BasicUsage.ts @@ -0,0 +1,2 @@ +import '@videojs/html/video/player'; +import '@videojs/html/ui/seek-button'; diff --git a/site/src/components/docs/demos/seek-button/react/css/BasicUsage.css b/site/src/components/docs/demos/seek-button/react/css/BasicUsage.css new file mode 100644 index 00000000..e75f8cdd --- /dev/null +++ b/site/src/components/docs/demos/seek-button/react/css/BasicUsage.css @@ -0,0 +1,27 @@ +.seek-button-basic { + position: relative; +} + +.seek-button-basic video { + width: 100%; +} + +.seek-button-basic__buttons { + display: flex; + gap: 8px; + position: absolute; + bottom: 10px; + left: 10px; +} + +.seek-button-basic__button { + padding-block: 8px; + background: rgba(255, 255, 255, 0.7); + backdrop-filter: blur(10px); + color: black; + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 9999px; + padding-inline: 20px; + white-space: nowrap; + cursor: pointer; +} diff --git a/site/src/components/docs/demos/seek-button/react/css/BasicUsage.tsx b/site/src/components/docs/demos/seek-button/react/css/BasicUsage.tsx new file mode 100644 index 00000000..4bdba1b0 --- /dev/null +++ b/site/src/components/docs/demos/seek-button/react/css/BasicUsage.tsx @@ -0,0 +1,41 @@ +import { createPlayer, features, SeekButton, Video } from '@videojs/react'; + +import './BasicUsage.css'; + +const Player = createPlayer({ features: [...features.video] }); + +export default function BasicUsage() { + return ( + + + + + ( + + {state.direction === 'backward' ? '\u23EA' : '\u23E9'} {5}s + + )} + /> + ( + + {10}s {state.direction === 'forward' ? '\u23E9' : '\u23EA'} + + )} + /> + + + + ); +} diff --git a/site/src/content/docs/reference/seek-button.mdx b/site/src/content/docs/reference/seek-button.mdx new file mode 100644 index 00000000..e12e0798 --- /dev/null +++ b/site/src/content/docs/reference/seek-button.mdx @@ -0,0 +1,69 @@ +--- +title: SeekButton +frameworkTitle: + html: media-seek-button +description: A button component for seeking media playback forward or backward by a specified number of seconds +--- + +import ApiReference from "@/components/docs/api-reference/ApiReference.astro"; +import FrameworkCase from "@/components/docs/FrameworkCase.astro"; +import StyleCase from "@/components/docs/StyleCase.astro"; +import Demo from "@/components/docs/demos/Demo.astro"; + +{/* React demos */} +import BasicUsageDemoReact from "@/components/docs/demos/seek-button/react/css/BasicUsage"; +import basicUsageReactTsx from "@/components/docs/demos/seek-button/react/css/BasicUsage.tsx?raw"; +import basicUsageReactCss from "@/components/docs/demos/seek-button/react/css/BasicUsage.css?raw"; + +{/* HTML demos */} +import BasicUsageDemoHtml from "@/components/docs/demos/seek-button/html/css/BasicUsage.astro"; +import basicUsageHtml from "@/components/docs/demos/seek-button/html/css/BasicUsage.html?raw"; +import basicUsageHtmlCss from "@/components/docs/demos/seek-button/html/css/BasicUsage.css?raw"; +import basicUsageHtmlTs from "@/components/docs/demos/seek-button/html/css/BasicUsage.ts?raw"; + +## Anatomy + + + ```tsx + + ``` + + + + ```html + + ``` + + +## Examples + +### Basic Usage + + + + + + + + + + + + + + + + + + diff --git a/site/src/docs.config.ts b/site/src/docs.config.ts index 972ebec4..024ffe2b 100644 --- a/site/src/docs.config.ts +++ b/site/src/docs.config.ts @@ -31,6 +31,7 @@ export const sidebar: Sidebar = [ { slug: 'reference/pip-button' }, { slug: 'reference/play-button' }, { slug: 'reference/poster' }, + { slug: 'reference/seek-button' }, { slug: 'reference/time' }, ], },