Video Plugin
Video plugin adds support for video slides via HTML <video> player.
Documentation
The plugin adds video Slide type with the following attributes. Most
attributes are identical to the ones present in the
<video>
HTML element.
| Property | Type | Description |
|---|---|---|
| type | "video" | video slide type marker |
| sources | { | an array of video files
|
| poster | string | video placeholder image |
| width | number | video width in pixels |
| height | number | video height in pixels |
| autoPlay | boolean | if true, the video automatically begins to play |
| controls | boolean | if true, the browser will offer controls to allow the user to control video playback |
| controlsList | string | indicates what controls to show |
| crossOrigin | string | indicates whether to use CORS to fetch the related video |
| preload | string | video preload setting |
| loop | boolean | if true, the browser will automatically seek back to the start upon reaching the end of the video |
| muted | boolean | the default setting of the audio contained in the video |
| playsInline | boolean | if true, the video is to be played "inline", that is within the element's playback area |
| disablePictureInPicture | boolean | prevents the browser from suggesting a Picture-in-Picture context menu |
| disableRemotePlayback | boolean | disables the capability of remote playback |
Additionally, the Video plugin adds the following Lightbox properties, which
can be used as defaults for all video slides within a lightbox.
| Property | Type | Description |
|---|---|---|
| video | { | All attributes are identical to the ones described above. Defaults: { controls: true, playsInline: true } |
Example
import Lightbox from "yet-another-react-lightbox";
import Video from "yet-another-react-lightbox/plugins/video";
import "yet-another-react-lightbox/styles.css";
// ...
return (
<Lightbox
plugins={[Video]}
slides={[
{
type: "video",
width: 1280,
height: 720,
poster: "/public/poster-image.jpg",
sources: [
{
src: "/public/video.mp4",
type: "video/mp4",
},
],
},
// ...
]}
// ...
/>
);
Live Demo
You can adjust the live demo settings below.