Skip to content

Commit

Permalink
docs: add custom player demo
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Apr 19, 2024
1 parent e7ab569 commit 47a8482
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default function Page() {
```


### Custom Player
### Custom Player ([Demo](https://next-video-demo.vercel.app/custom-player))

You can customize the player by passing a custom player component to the `as` prop.
The custom player component accepts the following props:
Expand All @@ -254,19 +254,21 @@ The custom player component accepts the following props:

```tsx
import Video from 'next-video';
import { ReactPlayerAsVideo } from './player';
import ReactPlayer from './player';
import awesomeVideo from '/videos/awesome-video.mp4';

export default function Page() {
return <Video as={ReactPlayerAsVideo} src={awesomeVideo} />;
return <Video as={ReactPlayer} src={awesomeVideo} />;
}
```

```tsx
// player.js
// player.tsx
'use client';

import ReactPlayer from 'react-player';

export function ReactPlayerAsVideo(props) {
export default function Player(props) {
let { asset, src, poster, blurDataURL, ...rest } = props;
let config = { file: { attributes: { poster } } };

Expand Down

0 comments on commit 47a8482

Please sign in to comment.