Video
The Video component is a custom wrapper around the ReactPlayer component, providing additional flexibility and customization options. It can be used to render videos from various sources (e.g., Vimeo, YouTube), with features such as custom placeholders, autoplay, video control displays, etc.
Importing
_10import { Video } from '@ef-global/backpack/Video';
Props
| Name | Type | Default | Description |
| autoplay | boolean | false | Set to true to automatically start video playback |
| placeholderImageSrc | string | URL of a custom placeholder image, shown before video load | |
| radius | BorderRadiusValues | 'xs' | Radius of the video player's corners |
| variant | BoxVariantValues | Defines the variant of the box, affecting the box-shadow and background color | |
| playing | boolean | false | Set to true to start playing on load |
| muted | boolean | false | Mutes the player on load |
| light | boolean or string | true | Show thumbnail before loading the player, or you can pass a custom image URL string |
| playIcon | ReactNode | Custom play icon to show when video is paused | |
| aspectRatio | string | '16/9' | Aspect ratio of the video player |
| alt | string | Alternative text to be displayed if the video cannot be rendered | |
| enableCc | boolean | false | Enable captions/subtitles, if available |
| className | string | Additional CSS classes to apply to the component | |
| url | string | The url of a video or song to play | |
| controls | boolean | false | Set to true or false to show or hide the player controls |
| loop | boolean | false | Set to true or false to loop the video once ended |
| playsinline | boolean | false | Set to true to allow the video to be played inline on iOS |
Usage
Here are a few examples of the Video component usage:
Default
_10<Video_10 url='https://vimeo.com/357511081'_10 playing={true}_10/>
With YouTube Video
_10<Video_10 url='https://www.youtube.com/watch?v=mhN3E_hlWmU'_10 controls={false}_10 playing={false}_10 light={false}_10/>
With Controls
_10<Video_10 url='https://vimeo.com/357511081'_10 controls={true}_10 playing={false}_10 light={false}_10/>
With Autoplay
_10<Video_10 url='https://vimeo.com/357511081'_10 autoplay={true}_10 playsinline={true}_10/>
With Loop
_10<Video_10 url='https://vimeo.com/357511081'_10 controls={true}_10 loop={true}_10/>
With Placeholder Image
_10<Video_10 url='https://vimeo.com/357511081'_10 controls={false}_10 playing={true}_10 light={true}_10/>
With Custom Placeholder Image
_10<Video_10 url='https://vimeo.com/357511081'_10 controls={false}_10 playing={true}_10 light={true}_10 placeholderImageSrc='https://a.storyblok.com/f/171771/4656x3492/bbf48d4721/wojciech-then-dija5f0vogq-unsplash.jpg'_10/>