Home/Video editor component
Video editor web component

A video editor component your users can trim, stitch and splice in your app

Put a real timeline editor on your own site with one element. Your users reorder clips, trim, split, cut sections out and pick crossfades; Save creates one new video in your account.

What the editor component does

<video-piper-editor> embeds the same timeline editor that the Video Piper app uses. Your users arrange some of your finished videos into a new one: drag clips to reorder them, drag their edges to trim, split at the playhead, cut out a section, and pick a crossfade or a fade through black for each join. Pressing Save makes one new video in your account (the originals are untouched), and the editor shows its progress, then the finished video. If <video-piper> is on the page it plays the result with it; otherwise it uses a plain video element.

Behind it is the same edit model as the video trimming API: every gesture produces the clips an edit takes, so the result is frame-accurate, up to 50 clips with transitions of 0.1 to 3 seconds. Keyboard shortcuts (space, arrows, S, I, O, Delete) work while the editor has focus.

The edit token model

Like the recorder, the editor never sees your API key. Your server makes an edit token naming the videos the current user may edit:

// 1. Your server (Node.js): an endpoint that makes a token (POST /edit-tokens with your API key)
app.post("/api/edit-token", async (req, res) => {   // check the user is signed in, as you need
  const videoIds = await videosThisUserMayEdit(req.user.id);   // your own lookup: up to 20 of your finished videos
  const r = await fetch(`${API}/edit-tokens`, { method: "POST",
    headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ videoIds, expiresIn: 900, maxSeconds: 600, metadata: { userId: String(req.user.id) } }) });
  res.status(r.status).json(await r.json());   // { token: "vpe_…", expiresAt, videoIds }
});
<!-- 2. Your page: the editor asks token-url for a token when it loads -->
<script src="https://videopiper.com/editor/editor.js"></script>
<video-piper-editor token-url="/api/edit-token"></video-piper-editor>
<script>
  document.querySelector("video-piper-editor")
    .addEventListener("vp-edit-done", (e) => console.log("new video", e.detail.videoId, e.detail.status));
</script>

Both come from the documentation, which also has an ASP.NET Core endpoint. The token body takes videoIds (1 to 20 of your finished videos), expiresIn (60 to 86400 seconds, default 900), maxSeconds (the longest the result may be), title (the new video's name) and metadata.

What a token can and can't do

Can

Read the named videos' length, size, a signed playback link, poster and filmstrip frames; create one edit from them, no longer than maxSeconds; read the status of the video that edit made.

Can't

List or delete videos, use any other video, upload, touch your account or make tokens. Those answer 403 EDIT_TOKEN_SCOPE, and the browser can't ask for higher quality, captions or redactions.

Is fixed by you

The new video's name and metadata come from the token whatever the browser sends, so your video.ready webhook can match it to a user.

The token is shown once, expires on its own, and once its edit exists it keeps working for that video's status for 24 hours. A second edit with the same token answers 409 EDIT_TOKEN_USED. The token counts toward your key's rate limits, and your allowed domains apply, so previews only play on your sites.

Attributes, events and styling

Your account page has these snippets filled in with your addresses, and a Try the editor button that makes a 15-minute token for your latest finished videos.

Which plans include the editor component

The editor component and its edit tokens work on every plan. The new video is processed and billed like any edit made with your API key, at your plan's quality, and counts toward your usage.

PlanPriceProcessing minutesMax qualityEditor component
Free$0/mo30720pIncluded
Starter$49/mo4001080pIncluded
Pro$199/mo1,5004KIncluded
Scale$699/mo6,0004KIncluded

Usage beyond a paid plan is billed at $0.09 per processing minute, $0.15 per GB-month of storage and $0.55 per GB of delivery. Full details are on the pricing page.

In the documentation

Frequently asked questions

What can my users do in the editor?

The same as in the app's timeline editor: drag clips to reorder them, drag their edges to trim, split at the playhead, cut a section out and pick a crossfade or a fade through black between clips. Save makes one new video; the original videos are untouched.

How does it keep my API key safe?

Your server makes an edit token for the videos you choose and the page uses that. The browser can only read those videos' length, signed preview link and filmstrip frames, create one edit from them and read that edit's status. Anything else answers 403 EDIT_TOKEN_SCOPE.

Can I limit what users create?

Yes. The token fixes the new video's title and metadata, caps the result at maxSeconds (longer edits answer 400 EDIT_TOO_LONG), and allows at most 20 source videos. A second edit with the same token answers 409 EDIT_TOKEN_USED.

How do I style it?

Set CSS custom properties such as --vp-accent, --vp-bg and --vp-panel on the element. Its styles live in a shadow root and never touch your page, and it follows the visitor's light or dark setting.

How big is the script?

editor.js includes the editor itself, about 80 KB compressed, so load it only on the pages that use it.

Start building with Video Piper

Create a free account with just your email, grab an API key and make your first request in minutes.