Backpack UI
Components
Video

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


_10
import { Video } from '@ef-global/backpack/Video';

Props

NameTypeDefaultDescription
autoplaybooleanfalseSet to true to automatically start video playback
placeholderImageSrcstringURL of a custom placeholder image, shown before video load
radiusBorderRadiusValues'xs'Radius of the video player's corners
variantBoxVariantValuesDefines the variant of the box, affecting the box-shadow and background color
playingbooleanfalseSet to true to start playing on load
mutedbooleanfalseMutes the player on load
lightboolean or stringtrueShow thumbnail before loading the player, or you can pass a custom image URL string
playIconReactNodeCustom play icon to show when video is paused
aspectRatiostring'16/9'Aspect ratio of the video player
altstringAlternative text to be displayed if the video cannot be rendered
enableCcbooleanfalseEnable captions/subtitles, if available
classNamestringAdditional CSS classes to apply to the component
urlstringThe url of a video or song to play
controlsbooleanfalseSet to true or false to show or hide the player controls
loopbooleanfalseSet to true or false to loop the video once ended
playsinlinebooleanfalseSet 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
/>