mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
@@ -0,0 +1,10 @@
|
||||
---
|
||||
import HtmlDemo from '@/components/docs/demos/HtmlDemo.astro';
|
||||
import html from './BasicUsage.html?raw';
|
||||
import './BasicUsage.css';
|
||||
---
|
||||
|
||||
<HtmlDemo html={html} />
|
||||
<script>
|
||||
import './BasicUsage.ts';
|
||||
</script>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<video-player class="seek-button-basic">
|
||||
<video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoplay
|
||||
muted
|
||||
playsinline
|
||||
loop
|
||||
></video>
|
||||
<div class="seek-button-basic__buttons">
|
||||
<media-seek-button seconds="-5" class="seek-button-basic__button">
|
||||
<span class="show-when-backward">⏪ 5s</span>
|
||||
</media-seek-button>
|
||||
<media-seek-button seconds="10" class="seek-button-basic__button">
|
||||
<span class="show-when-forward">10s ⏩</span>
|
||||
</media-seek-button>
|
||||
</div>
|
||||
</video-player>
|
||||
@@ -0,0 +1,2 @@
|
||||
import '@videojs/html/video/player';
|
||||
import '@videojs/html/ui/seek-button';
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 (
|
||||
<Player.Provider>
|
||||
<Player.Container className="seek-button-basic">
|
||||
<Video
|
||||
src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4"
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
loop
|
||||
/>
|
||||
<div className="seek-button-basic__buttons">
|
||||
<SeekButton
|
||||
seconds={-5}
|
||||
className="seek-button-basic__button"
|
||||
render={(props, state) => (
|
||||
<button {...props}>
|
||||
{state.direction === 'backward' ? '\u23EA' : '\u23E9'} {5}s
|
||||
</button>
|
||||
)}
|
||||
/>
|
||||
<SeekButton
|
||||
seconds={10}
|
||||
className="seek-button-basic__button"
|
||||
render={(props, state) => (
|
||||
<button {...props}>
|
||||
{10}s {state.direction === 'forward' ? '\u23E9' : '\u23EA'}
|
||||
</button>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Player.Container>
|
||||
</Player.Provider>
|
||||
);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
<FrameworkCase frameworks={["react"]}>
|
||||
```tsx
|
||||
<SeekButton />
|
||||
```
|
||||
</FrameworkCase>
|
||||
|
||||
<FrameworkCase frameworks={["html"]}>
|
||||
```html
|
||||
<media-seek-button></media-seek-button>
|
||||
```
|
||||
</FrameworkCase>
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Usage
|
||||
|
||||
<FrameworkCase frameworks={["react"]}>
|
||||
<StyleCase styles={["css"]}>
|
||||
<Demo
|
||||
files={[
|
||||
{ title: "App.tsx", code: basicUsageReactTsx, lang: "tsx" },
|
||||
{ title: "App.css", code: basicUsageReactCss, lang: "css" },
|
||||
]}
|
||||
>
|
||||
<BasicUsageDemoReact client:idle />
|
||||
</Demo>
|
||||
</StyleCase>
|
||||
</FrameworkCase>
|
||||
|
||||
<FrameworkCase frameworks={["html"]}>
|
||||
<StyleCase styles={["css"]}>
|
||||
<Demo
|
||||
files={[
|
||||
{ title: "index.html", code: basicUsageHtml, lang: "html" },
|
||||
{ title: "index.css", code: basicUsageHtmlCss, lang: "css" },
|
||||
{ title: "index.ts", code: basicUsageHtmlTs, lang: "ts" },
|
||||
]}
|
||||
>
|
||||
<BasicUsageDemoHtml />
|
||||
</Demo>
|
||||
</StyleCase>
|
||||
</FrameworkCase>
|
||||
|
||||
<ApiReference component="SeekButton" />
|
||||
@@ -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' },
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user