Skip to main content

layermetry SDK

Welcome to the Next.js integration documentation for @layermetry/media-editor.

Overview

The @layermetry/media-editor SDK provides powerful image and video editing capabilities for React applications. This documentation covers everything you need to integrate the SDK into your Next.js project.
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.

Documentation Files

Integration Guides

  1. Next.js ImageEditor Integration
    • Complete guide for ImageEditor integration
    • Interface documentation and prop reference
    • Theme customization examples
    • Step-by-step implementation
    • Callback handling and export options
  2. Next.js VideoEditor Integration
    • Complete guide for VideoEditor integration
    • WASM setup instructions (critical!)
    • Video processing workflow
    • Performance considerations
    • Export and encoding options

Troubleshooting

  1. FAQ
    • Common issues and solutions
    • React version compatibility problems
    • License validation errors
    • WASM loading failures
    • Build and deployment issues
    • Quick troubleshooting checklist

Quick Start

1. Install Dependencies

2. Configure Next.js

next.config.js:

3. Import SDK Styles

app/globals.css:

4. Use Dynamic Imports

5. Copy WASM Files (Video Only)

Key Concepts

Which React version?

Version 2 works in React 18 and React 19. It also works with no React at all — the editor ships as a browser custom element, so Vue, Angular, Svelte and plain HTML all run the same bundle. If you pinned react@18.2.0 for version 1, remove the pin.

Why Dynamic Imports?

The SDK uses browser-only APIs (Canvas, WebAssembly, Web Workers) that don’t exist during server-side rendering. Dynamic imports with ssr: false ensure the SDK only loads in the browser.

Why WASM Files?

VideoEditor uses FFmpeg (compiled to WebAssembly) for video processing. These WASM modules (33MB total) must be in your public/ folder so the browser can load them at runtime.

Theme System

Both editors support extensive theming through the theme prop. You can customize:
  • Background colors (primary, secondary, tertiary)
  • Text colors (primary, secondary)
  • Accent colors (primary, secondary, hover)
  • Border colors
  • Component-specific colors (buttons, inputs, toolbar, canvas, etc.)

Architecture

Common Patterns

File Upload with Preview

Export and Download

Custom Theme

Example Project

A complete working example is available in the SDK package at examples/nextjs/. This includes:
  • Landing page with studio selection
  • Image Studio with drag-and-drop
  • Video Studio with export modal
  • Custom branded theme implementation
  • Proper file handling and state management

API Reference

ImageEditor Props

VideoEditor Props

Performance Tips

Image Editor

  • ✅ Fast load time (~500ms)
  • ✅ Works on mobile devices
  • ✅ Low memory usage (less than 100MB)
  • ✅ Instant export

Video Editor

  • ⚠️ Longer load time (~2s) due to WASM
  • ⚠️ Desktop only (mobile not supported)
  • ⚠️ High memory usage (500MB+ for HD video)
  • ⚠️ Slow export (1-2 minutes for 30s 1080p video)
Recommendations:
  1. Show loading indicators during export
  2. Warn users about processing time
  3. Recommend shorter clips or lower resolution
  4. Consider server-side processing for production apps

Version Compatibility

Version 2 no longer brings its own copy of React, so the host framework version no longer constrains the SDK. The same bundle also runs with no React installed at all.

Support

Documentation

  • Integration Guides: This folder
  • API Docs: Coming soon
  • Video Tutorials: Coming soon

Getting Help

Reporting Bugs

Please include:
  1. Next.js version
  2. React version
  3. SDK version
  4. Error messages
  5. Steps to reproduce
  6. Browser/OS information

License

@layermetry/media-editor is commercial software. See the terms of use for the licence terms.

Changelog

v2.0.0 (Current)

  • Published as @layermetry/media-editor. The old @distralabs name is retired.
  • Works in React 18 and React 19, in Vue, Angular, Svelte, Next.js and plain HTML — the editor ships as a browser custom element, so the host framework no longer matters.
  • One package instead of 162.
  • ffmpeg removed: 31 MB of WebAssembly is now 0. Export uses the browser’s own video hardware.
  • A faster export path, measured at 4.4 times the previous exporter. Opt in with export={{ experimental: true }}.

v1.1.9

  • Next.js 14 compatibility
  • React 18.2 support
  • Theme customization
  • Video timeline improvements
  • Bug fixes

Ready to get started? Choose your integration guide: Having issues?