Basic Video Player
A simple implementation of the video player with default controls
0:00 / 0:00
Code Example
tsx
1import { VideoPlayer } from 'react-advanced-video-player';23function App() {4 return (5 <VideoPlayer 6 src="https://example.com/video.mp4" 7 poster="https://example.com/poster.jpg"8 controls9 />10 );11}
How it Works
The basic video player is the simplest implementation of the React Advanced Video Player component. It requires only a few props to get started:
src
: The URL of the video file to playposter
(optional): The URL of an image to display before the video playscontrols
: Whether to show the default player controls
Note: When controls
is set to true
, the player will display its default controls. If you want to create custom controls, set this to false
and provide your own controls implementation. See the Custom Controls Examplefor more information.
Additional Options
The basic implementation can be enhanced with additional props:
tsx
1import { VideoPlayer } from 'react-advanced-video-player';23function EnhancedBasicPlayer() {4 return (5 <VideoPlayer 6 src="https://example.com/video.mp4" 7 poster="https://example.com/poster.jpg"8 controls9 autoPlay={false}10 muted={true}11 loop={false}12 preload="metadata"13 width="100%"14 height="auto"15 onPlay={() => console.log('Video started playing')}16 onPause={() => console.log('Video paused')}17 onEnded={() => console.log('Video ended')}18 />19 );20}
See the Player API documentation for a full list of available props.