What you are installing
@layermetry/media-editor is one npm package that puts a working image editor
or video editor inside your own page. It is not an iframe and it is not a hosted
service you redirect people to. The editor becomes part of your page, so it
inherits your fonts and your layout and you can style it.
The current version is 2.0.0.
If you are moving from version 1, the package name has changed. Anything that
still reads
@layermetry/media-editor is out of date — the package is now
@layermetry/media-editor.What it needs to run
React 18 and React 19 both work
Version 2 works in React 18 and React 19. It also works with no React at all. This is a change worth spelling out, because the old documentation said the opposite. Version 1 was built on React 18.2.0 and told you to pinreact@18.2.0 and react-dom@18.2.0. Version 2 does not. The editor no longer
brings its own copy of React into your application: it ships as a
custom element, which is a tag the browser itself knows how to render, the
same way it knows <video>. Your framework only has to put the tag on the page.
That is why the same bundle runs in React, in Vue with no React installed at
all, in Angular, in Svelte, in Next.js and in a plain HTML file.
Put an editor on the page
There are two ways in, and they do the same thing.mount(element, props)— a function. You give it a DOM element and the settings, it puts the editor inside. This works everywhere, in any framework and in none.- The React components —
ImageEditorandVideoEditor, from@layermetry/media-editor/react. This is a thin wrapper around the same thing, so React people can pass props and not think about DOM elements.
- React
- Next.js
- Vue
- Angular
- Svelte
- Plain HTML
The licence key
The editor checks a licence key in the browser when it starts.NEXT_PUBLIC_ or VITE_ variable is fine.
Exporting is faster if you ask for it
Exporting — turning what is on the timeline into a finished file — runs entirely in the reader’s own browser tab, using the video hardware in their machine. No file is uploaded, and there is noffmpeg involved. In version 1, ffmpeg
arrived as 31 MB of WebAssembly that every visitor downloaded; in version 2 that
is 0 MB.
There is a newer export path that is measured at 4.4 times faster than the
previous exporter. It is not on by default yet, so you have to ask for it:
mount:
experimental because it is newer and has had less time in front of
real files, not because it produces a different result. 4K export works today.
Video editing needs two headers
This one costs people an afternoon if they meet it by surprise, so it is worth setting up before you write any code. The video editor decodes and encodes video using several threads at once, and those threads share one block of memory. Browsers only allow that sharing on a page that has been put in its own isolated process, away from any other site. You ask for that isolation by sending two extra lines with the page — two HTTP response headers:SharedArrayBuffer. The image editor
does not need them.
The second header has a consequence that catches people out. require-corp
means the browser will refuse to load anything from another site onto that page
unless that other site explicitly allows it. So images, fonts and scripts you
pull from a content delivery network will start failing on that page. Either
serve them from your own domain, or make sure they send
Cross-Origin-Resource-Policy: cross-origin back.
- Next.js
- Vite
- Nginx
false, one of the two headers is missing or is being overwritten
further along — a proxy or a content delivery network in front of your server is
the usual culprit.
Using your own AI models
Any AI feature in the editor can go to your own endpoint instead of ours. You give it a list of providers and the address of your own proxy, and inference requests go from the reader’s browser to your endpoint. In that arrangement the media never reaches layermetry at all.Next
Install for agents
The same SDK, set up so a coding agent can drive it: verbs, previewing a
plan before it runs, and a record of what ran.
API reference
Every prop and every method on both editors.

