Tiny Video

The react video component you always wanted. Ultra lightweight, no dependencies, and fully customizable.

Features

  • No layout shift.
  • Placeholder support.
  • Minimal ui.
  • Fully customizable.
  • No dependencies.

Installation

npm install @stylessh/tiny-video

Usage

<TinyVideo src="/demo.mp4" className="w-full aspect-video" />

TinyVideo is a React component that renders a video element. It is a wrapper around the native <video> element.

TinyVideo Props

PropTypeDefaultDescription
srcstringundefinedThe source of the video.
classNamestringundefinedThe class name of the video.
posterstringundefinedThe poster of the video. If not provide, the first frame (blurred) of the video will be used as poster.
autoPlaybooleanfalseWhether to autoplay the video.
mutedbooleanfalseWhether to mute the video.
loopbooleanfalseWhether to loop the video.
controlsbooleantrueWhether to show the video controls.
onLoadedfunctionundefinedThe callback function when the video is loaded.
onErrorfunctionundefinedThe callback function when the video is error.

License

MIT

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Created by Alan