|
| 1 | +## @graphland/react-video-player |
| 2 | + |
| 3 | +A customizable React component serving as a wrapper for the popular Video.js library. This component provides a sleek and responsive video player with theme options. |
| 4 | + |
| 5 | +### Installation |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install @your-username/react-video-player |
| 9 | +``` |
| 10 | + |
| 11 | +### Usage |
| 12 | + |
| 13 | +```bash |
| 14 | +import React from 'react'; |
| 15 | +import VideoPlayer, { Props } from '@graphland/react-video-player'; |
| 16 | + |
| 17 | +const App: React.FC = () => { |
| 18 | + const videoSources = [ |
| 19 | + { src: 'https://media.w3.org/2010/05/sintel/trailer_hd.mp4', type: 'video/mp4' }, |
| 20 | + // Add more video sources as needed |
| 21 | + ]; |
| 22 | + |
| 23 | + const videoProps: Props = { |
| 24 | + theme: 'city', // 'city', 'fantasy', 'forest', 'sea' |
| 25 | + height: 720, |
| 26 | + width: 1280, |
| 27 | + autoPlay: false, |
| 28 | + loop: false, |
| 29 | + sources: videoSources, |
| 30 | + controlBar: { |
| 31 | + skipButtons: { |
| 32 | + forward: 5, |
| 33 | + backward: 5, |
| 34 | + }, |
| 35 | + }, |
| 36 | + playbackRates: [0.5, 1, 1.5, 2], |
| 37 | + disablePictureInPicture: false, |
| 38 | + onReady: () => { |
| 39 | + console.log('Video player is ready!'); |
| 40 | + }, |
| 41 | + }; |
| 42 | + |
| 43 | + return ( |
| 44 | + <VideoPlayer {...videoProps} /> |
| 45 | + ); |
| 46 | +}; |
| 47 | + |
| 48 | +export default App; |
| 49 | +``` |
| 50 | +
|
| 51 | +#### Props |
| 52 | +
|
| 53 | +- `theme` (optional): Choose from 'city', 'fantasy', 'forest', 'sea' for different player themes. |
| 54 | +- `height` (optional): Height of the video player in pixels. |
| 55 | +- `width` (optional): Width of the video player in pixels. |
| 56 | +- `autoPlay` (optional): Automatically start playing the video when the component mounts. |
| 57 | +- `loop` (optional): Enable looping of the video. |
| 58 | +- `sources` (required): An array of video sources with `{ src: string, type: string }` format. |
| 59 | +- `poster` (optional): URL for the video poster image. |
| 60 | +- `controlBar` (optional): Additional configuration for the video control bar, including skip buttons. |
| 61 | +- `playbackRates` (optional): Array of playback rates available to the user. |
| 62 | +- `disablePictureInPicture` (optional): Disable the Picture-in-Picture mode. |
| 63 | +- `onReady` (optional): Callback function called when the video player is ready. |
0 commit comments