Skip to main content

Overview

The Video plugin provides a complete solution for adding videos to your content. It supports file uploads, embedding from video providers (YouTube, Vimeo, Dailymotion, Loom, Wistia), video resizing, and various playback options.

Installation

Basic Usage

Pass the plugin to createYooptaEditor; do not pass plugins to <YooptaEditor>.
Required ConfigurationYou must configure the upload option. Without this option, you’ll see an error when trying to use the Video plugin.
See the Configuration section below for detailed examples.

Features

  • File Upload: Upload videos from device
  • Provider Embedding: Embed videos from YouTube, Vimeo, Dailymotion, Loom, and Wistia
  • URL Insertion: Insert videos via URL (automatically detects provider)
  • Custom Upload Functions: Direct uploads to Cloudinary, S3, Firebase, Mux, etc.
  • Video Resizing: Resize videos while maintaining aspect ratio
  • Size Limits: Set maximum width and height
  • Object Fit: Control how videos fit their container
  • Playback Settings: Configure controls, loop, muted, and autoplay
  • Poster Images: Set custom poster/thumbnail images
  • Video Deletion: Optional deletion handling with custom functions (if not configured, deletion only removes from editor)
  • Responsive: Automatically adapts to screen size

Configuration

The Video plugin supports two approaches for upload and delete operations:
  1. Endpoint-based: Configure an API endpoint and the plugin handles the request
  2. Custom function: Provide your own async function for complete control (useful for direct uploads to Cloudinary, S3, Firebase, Mux, etc.)

Endpoint-based Upload (Backend API)

Custom Upload Function (Direct to Cloud)

For direct uploads to third-party services like Cloudinary, AWS S3, Firebase Storage, or Mux, you can provide a custom async function:

Provider URL Embedding

The Video plugin automatically detects and embeds videos from supported providers when you paste a URL:
Supported Providers:
  • YouTube: youtube.com, youtu.be
  • Vimeo: vimeo.com
  • Dailymotion: dailymotion.com, dai.ly
  • Loom: loom.com
  • Wistia: wistia.com, wistia.net
When a user pastes a URL from any of these providers, the plugin automatically:
  1. Detects the provider
  2. Extracts the video ID
  3. Generates the embed URL
  4. Optionally fetches the thumbnail

Options

upload

Can be either an object (endpoint-based) or a function (custom upload):
object

delete (optional)

Can be either an object (endpoint-based) or a function (custom delete). If not provided, deleting a video block will only remove it from the editor without calling any storage deletion logic.
object
object | function
Optional. Upload function for poster/thumbnail images. Can be endpoint-based or custom function, similar to upload.
object
object
array
Optional. Array of allowed video provider types. If not set, all providers are allowed.Supported values: 'youtube' | 'vimeo' | 'dailymotion' | 'loom' | 'wistia'
string
default:"video/*"
Accepted video file types (e.g., “video/mp4,video/webm,video/ogg”)
number
Maximum file size in bytes

Element Props

string | null
Video source URL (for direct video files) or embed URL (for provider videos)
object | null
Provider information for embedded videos:
object
Video playback settings:
object
Video dimensions: { width: number | string, height: number | string }
'contain' | 'cover' | 'fill' | null
How the video should fit its container
string | null
URL of the poster/thumbnail image to display before video loads
string | null
Responsive video source set
string | null
Background color for video container

Commands

Provider Utilities

The Video plugin exports utility functions for working with video providers:

Upload Response Format

Your upload endpoint should return:

Custom Rendering

Parsers

HTML Deserialization

The plugin automatically deserializes <video> tags:

HTML Serialization

Markdown Serialization

Use Cases

Blog Posts

Embed tutorial videos and demonstrations

Documentation

Video guides and walkthroughs

Portfolios

Showcase project videos and reels

Product Demos

Feature product videos and tutorials

Educational Content

Course videos and lectures

Social Media

Embed YouTube and Vimeo content

Best Practices

Compress videos before uploading to reduce file size and improve load times
Set a poster image to improve user experience while video loads
Configure appropriate maxWidth and maxHeight for your design
Browser autoplay policies may require videos to be muted for autoplay to work
Handle upload errors gracefully with user feedback
For large videos, consider using provider embedding (YouTube, Vimeo) instead of direct uploads

Hooks

useVideoUpload

Supports both endpoint-based and custom function approaches:

useVideoDelete

Supports both endpoint-based and custom function approaches:

useVideoPreview

Generate a preview URL for a video file before uploading:

useVideoPosterUpload

Upload poster/thumbnail images separately:

Troubleshooting

This error occurs when you’re using a theme but haven’t configured the upload option.Solution: Add an upload configuration to your Video plugin:
If you want to delete videos from your storage when removed from the editor, you need to configure the delete option.Solution: Add a delete configuration to your Video plugin:
Note: The delete option is optional. Without it, videos are only removed from the editor.
This error occurs when using endpoint-based configuration without providing the endpoint URL.Solution: Make sure to include the endpoint property:
If a provider URL is not being detected, check:
  1. The URL format matches supported patterns
  2. The provider is in the allowedProviders list (if configured)
  3. The URL is from a supported provider (YouTube, Vimeo, Dailymotion, Loom, Wistia)
Solution: Use the parseVideoUrl utility to debug:
Many browsers block autoplay unless the video is muted. Make sure to set muted: true when using autoPlay: true.Solution: