Video

Videos are used to embed and play video content with custom controls and captions.

Examples

Link to This Section

Adding Video Sources

Link to This Section

The simplest way to add a video is with the src attribute.

For multiple formats or additional options, use <source> elements instead.

<wa-video title="Using Kits in Your Project" poster="/assets/images/fa-part-1.jpg">
  <source src="https://uploads.webawesome.com/01-create-your-first-kit.mp4" type="video/mp4" />
  <source src="https://uploads.webawesome.com/01-create-your-first-kit.ogv" type="video/ogg" />
  <source src="https://uploads.webawesome.com/01-create-your-first-kit.webm" type="video/webm" />
</wa-video>

Controls

Link to This Section

The video player offers three control presets: none, standard, and full.

None

Link to This Section

No controls are displayed. The video can still be played programmatically via JavaScript, and the poster overlay and captions remain visible.

Standard

Link to This Section

Displays playback, a seekable timeline, elapsed/total time, volume, captions, and fullscreen controls.

Full

Link to This Section

Includes everything in standard, plus playback speed selection and picture-in-picture.

Poster Images

Link to This Section

Add a poster image that displays before the video plays. If no poster is provided, no overlay is shown and the browser will display the first frame of the video instead.

Captions and Subtitles

Link to This Section

Add a <track> element to enable captions using standard WebVTT files.

Captions are rendered above the video controls and automatically adjust position when controls show or hide.

Icon Slots

Link to This Section

Several slots like poster-icon and pause-icon are provided to let you customize which icons you'd like to show.

Playlists

Link to This Section

To group multiple videos into a playlist, use <wa-video-playlist>.

Video Recommendations

Link to This Section

Recommended to ensure fast loading, broad browser compatibility, and the best playback experience across devices.

Video Encoding

Link to This Section
Setting Recommended Reason
Codec H.264 (MP4) Broadest browser and device support
Resolution 1280×720 (720p) Good balance of quality and file size
Frame rate 24–30fps Smooth motion without excess data
Bitrate 2–5 megabits/s Good quality at 720p without buffering

Poster Images

Link to This Section
Setting Recommended Reason
Format JPEG (80–85%) or WebP Small file size with wide browser support
File size Under 200KB Fast initial load before video starts
Aspect ratio 16:9 Matches standard video dimensions
Resolution Match video exactly Prevents layout shift on load

Caption Files

Link to This Section
Setting Recommended Reason
Format WebVTT (.vtt) Only format supported by the HTML <track> element
Encoding UTF-8 Ensures special characters and non-Latin scripts render correctly
Timing Frame accurate Prevents captions from appearing early or late

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://ka-f.webawesome.com/[email protected]/components/video/video.js';

After installing Web Awesome via npm, import this component:

import '@awesome.me/webawesome/dist/components/video/video.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/video/video.js';

To import this component for React 18 or below, use the following code:

import WaVideo from '@awesome.me/webawesome/dist/react/video/index.js';

Slots

Link to This Section

Learn more about using slots.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Methods

Link to This Section

Learn more about methods.

Events

Link to This Section

Learn more about events.

CSS custom properties

Link to This Section

Learn more about CSS custom properties.

CSS parts

Link to This Section

Learn more about CSS parts.

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

Need a hand? Report a bug Ask for help