Skip to content

Video

A custom video player component for displaying videos on a page.

See all the examples and details in the Storybook.

Usage

tsx
import { Video } from "@samgl/graffiti-ui";

const MyVideo = () => {
  return (
    <Video
      sources={[
        {
          src: "http://localhost:8000/test2.mp4",
          type: "video/mp4",
        },
      ]}
      $width="640px"
      $height="360px"
    />
  );
};

Props

PropTypeDefaultOptionalDescription
sourcesVideoProps[sources]An array of sources to display in the video.
$widthstringThe width of the video.
$heightstringThe height of the video.
controlsbooleantrueIf true the video will display controls.
$showControls"always" | "hover""always"If "always" the video will always display controls. If "hover" the controls will only display when the mouse is over the video.
autoPlaybooleanfalseIf true the video will start playing automatically.
loopbooleanfalseIf true the video will loop.
mutedbooleanfalseIf true the video will be muted.
preload"none" | "metadata" | "auto""metadata"The preload behaviour of the video.
classNamestringThe class name of the component, generally used when extending the component with a styled component.