Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfarrant committed Jan 8, 2025
1 parent 8055324 commit 0dbb04b
Showing 1 changed file with 32 additions and 35 deletions.
67 changes: 32 additions & 35 deletions apps/docs/content/components/VideoPlayer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,45 +127,42 @@ The `VideoPlayer` component exposes a `useVideo` hook that can be used to contro

Full documentation for the `useVideo` hook can be found [below](#usevideo-context).

```tsx live
;() => {
const MyVideoPlayer = () => {
const {isPlaying, togglePlaying, seek} = useVideo()

return (
<Stack direction="vertical">
<VideoPlayer
title="GitHub media player"
showPlayPauseButton={false}
showSeekControl={false}
showCCButton={false}
showMuteButton={false}
showVolumeControl={false}
showFullScreenButton={false}
>
<VideoPlayer.Source
src="/brand/assets/example.mp4"
type="video/mp4"
/>
<VideoPlayer.Track src="/brand/assets/example.vtt" default />
</VideoPlayer>
<Stack direction="horizontal">
<Button onClick={() => togglePlaying()}>
{isPlaying ? 'Pause' : 'Play'}
</Button>
<Button onClick={() => seek(0)}>Go to start</Button>
<Button onClick={() => seek((t) => t + 5)}>Skip 5 seconds</Button>
</Stack>
</Stack>
)
}
```javascript live noinline
const CustomVideoPlayer = () => {
const {isPlaying, togglePlaying, seek} = useVideo()

return (
<VideoPlayer.Provider>
<MyVideoPlayer />
</VideoPlayer.Provider>
<Stack direction="vertical">
<VideoPlayer
title="GitHub media player"
showPlayPauseButton={false}
showSeekControl={false}
showCCButton={false}
showMuteButton={false}
showVolumeControl={false}
showFullScreenButton={false}
>
<VideoPlayer.Source src="/brand/assets/example.mp4" type="video/mp4" />
<VideoPlayer.Track src="/brand/assets/example.vtt" default />
</VideoPlayer>
<Stack direction="horizontal">
<Button onClick={() => togglePlaying()}>
{isPlaying ? 'Pause' : 'Play'}
</Button>
<Button onClick={() => seek(0)}>Go to start</Button>
<Button onClick={() => seek((t) => t + 5)}>Skip 5 seconds</Button>
</Stack>
</Stack>
)
}

const App = () => (
<VideoPlayer.Provider>
<CustomVideoPlayer />
</VideoPlayer.Provider>
)

render(<App />)
```

## useVideo Context
Expand Down

0 comments on commit 0dbb04b

Please sign in to comment.