Skip to main content

Overview

The VideoEditor component provides a powerful video editing interface with timeline, effects, text overlays, transitions, and export capabilities.
This page still describes the version 1 setup. In version 2 (@layermetry/media-editor 2.0.0) ffmpeg was removed, so the 31 MB of WebAssembly named below no longer ships with the package and there is nothing to copy into public/. React is no longer pinned to 18.2.0 either — React 18 and React 19 both work, and the editor also runs with no React at all.Follow Installation for the version 2 setup. This page is being rewritten.

Import

Always use dynamic import with ssr: false to avoid server-side rendering issues.

Prerequisites

CRITICAL: VideoEditor requires WASM files to be copied to your public/ folder. See Installation Guide.

Required WASM Files

URL Rewrites

Add to next.config.js:

Props

Required Props

string
required
Your SDK license key (JWT format). Contact your account manager to obtain a license key.
() => void
required
Callback function called when the user closes the editor.

Optional Props

string
Override the default license validation API endpoint.Default: https://api.kloudleads.com/license/validate
File
Initial video file to load into the editor.
Supported Formats: MP4, WebM, MOV, AVI
(result: EditorCallback) => void
Callback function called when the user exports the edited video.EditorCallback:
Example:
Record<string, string>
Custom theme object to override default colors and styling.
See Theme Customization for all available keys.
boolean
default:"false"
Show theme customization UI to users. Set to false for production.
BrandDetails[]
Array of brand presets for consistent styling.
Template
Load a template on editor startup.
(props: { brandId: string; template: Template }) => Promise<void>
Callback when user saves a template.
(brandIdList: string[]) => Promise<{ success: { data: Template[] } }>
Callback to fetch templates for display.
CreateAutomatedContent
AI-powered content creation function (advanced feature).

Complete Example


Features

Video Editing

  • Upload & Load: MP4, WebM, MOV, AVI formats
  • Trim: Cut video start and end times
  • Split: Cut video into multiple clips
  • Arrange: Drag-and-drop clips on timeline
  • Speed: Adjust playback speed (0.25x - 4x)
  • Volume: Audio volume control and mute

Timeline

  • Multi-track: Video, audio, text, subtitle tracks
  • Zoom: Timeline zoom in/out
  • Scrubbing: Frame-accurate seeking
  • Snap: Snap-to-grid for precise alignment
  • Markers: Add markers for reference points

Text & Graphics

  • Text Overlays: Add text with custom fonts, colors, sizes
  • Shapes: Rectangles, circles, arrows, custom shapes
  • Stickers: GIF stickers and emojis
  • Images: Overlay images on video

Effects & Filters

  • Color Filters: Grayscale, Sepia, Invert, Colorize
  • Adjustments: Brightness, Contrast, Saturation
  • Blur: Gaussian blur with adjustable radius
  • Transitions: Fade in/out, crossfade (coming soon)

Audio

  • Audio Tracks: Multiple audio tracks
  • Background Music: Add music files
  • Volume Control: Per-track volume adjustment
  • Mute: Mute original video audio

Subtitles

  • SRT Support: Import .srt subtitle files
  • Styling: Font, color, size, position
  • Word Highlighting: Highlight current word (karaoke style)
  • Background: Subtitle background with opacity

Export

  • Format: MP4 (H.264 video, AAC audio)
  • Quality: Adjustable bitrate and resolution
  • Frame Rate: Original or custom FPS
  • Audio: Include/exclude audio tracks

Performance Considerations

Video processing is CPU-intensive and happens in the browser using WebAssembly (FFmpeg).

Typical Export Times

Recommendations

  1. Show Progress Indicator: Always display a loading overlay during export
  2. Warn Users: Inform users about processing time upfront
  3. Limit Duration: Recommend videos under 60 seconds for browser processing
  4. Lower Resolution: Suggest 720p for faster exports
  5. Desktop Only: Mobile browsers not supported for video editing
  6. Server-Side Alternative: Consider server-side processing for production apps

Mobile Support

Mobile browsers have limited support due to memory constraints and missing WebAssembly features. Desktop browsers strongly recommended.

Browser Support


Troubleshooting

WASM Files Not Loading

Error: MediaInfoModule.wasm 404 Not Found Solution:
  1. Copy WASM files to public/ folder
  2. Add URL rewrites to next.config.js
  3. Restart dev server: rm -rf .next && npm run dev
See FAQ: WASM Loading Failures

Audio Not Playing

Cause: Browser autoplay policies require user interaction. Solution: Ensure editor is opened via user click/gesture, not programmatically on page load.

Export Fails or Hangs

Causes:
  • Video too long (>2 minutes)
  • Resolution too high (4K)
  • Insufficient memory
Solutions:
  • Use shorter clips
  • Lower resolution to 720p
  • Close other browser tabs
  • Increase Node.js memory: NODE_OPTIONS=--max-old-space-size=4096

Next Steps

Integration Guide

Step-by-step Next.js integration

ImageEditor API

ImageEditor component reference

Troubleshooting

Common issues and solutions

Installation

Installation guide