AI assistant
Let users edit a video with natural-language instructions.
The AI assistant edits the video from a conversation. The user types a request, such as "Add a title that says Summer sale", and the assistant makes the change on the canvas and answers in words.
Capabilities
The assistant uses the same editing actions as the editor's own controls, so every change can be undone, and appears in saved designs and in the export. The editor has 92 actions, and the assistant is offered 89 of them. The other three change locks. Only a person may run them: the assistant is not offered them, and it is refused when it calls one. The assistant's 89 actions are in these groups:
| Group | Actions | Examples |
|---|---|---|
| Text | 16 | Add text, change words, font, size, color, weight, and effects, and give text a whole text style at once |
| Captions | 7 | Add captions, make captions from a clip's sound, change their lines and their style |
| Items | 13 | Move, resize, rotate, layer, group, animate, and place in time |
| Media | 10 | Add pictures and clips from web addresses, crop, mask, and filter |
| Canvas | 9 | Resize the canvas, and set a color, gradient, picture, or blurred copy of an item as background |
| Shapes | 5 | Add shapes and lines, and set their colors |
| Audio | 8 | Add sound from a web address, set volume and fades, apply presets, replace part of a clip, and prepare a voiceover script |
| Clips | 4 | Split, join, mute, and change the speed of clips |
| Reading | 7 | Read the canvas, find items, check the layout, and write the captions as a file |
| Export | 4 | Start, list, and cancel exports, and check which files keep the sound in this browser |
| Playback | 3 | Play, pause, and move the playhead |
| Labels | 3 | Legacy actions to add a label item and change its words or style. |
Editor actions lists every action.
The assistant also receives the active brand kit: its colors, text styles, and writing fields. So it can use the brand's colors and text styles when it edits.
The assistant also reads the design before it acts, so it can find "the title" or "the red circle" by what they are.
Enabling the assistant
The assistant appears only when you pass a valid ai prop. It talks to a chat service at your media server: POST {mediaApiUrl}/video-editor-chat. Configure your own mediaApiUrl for chat. ai={{ hosted: true }} uses Layermetry’s service when no media address is set. Hosted AI is coming soon. Available only with an enterprise licence from Layermetry.
import { VideoEditor, type ChatEvent } from '@layermetry/media-editor/react';
function handleChatEvent(event: ChatEvent) {
console.log(`chat event: ${event.type}`);
}
export default function App() {
return (
<div style={{ position: 'fixed', inset: 0 }}>
<VideoEditor
licenseKey="YOUR_LICENSE_KEY"
onClose={() => console.log('The editor was closed')}
// The assistant talks to the chat service at your media server.
mediaApiUrl="https://media.example.com"
// Without a valid ai prop, the editor shows no assistant.
ai={{ endpointUrl: 'https://api.example.com/ai' }}
onChatEvent={handleChatEvent}
/>
</div>
);
}Open AI Assistant at the bottom of the tool rail, or AI Chat in the compact dock. The user types a request and presses Send. New chat starts a new conversation.
The editor sends the conversation and the list of actions. The chat service answers with a stream. When the service asks for an action, the editor runs it on the canvas and sends the result back. One request can take up to 8 such rounds.
The AI Assistant button and the AI Chat tile show only when ai is given and valid. To remove the assistant while you keep ai, set ui={{ features: { 'ai.chat': false } }}.
Limitations
- The assistant needs the chat service. It sends every request there, with your license key.
- One request runs at most 8 rounds of actions. For a longer job, the user sends another request.
- The assistant changes the design in the editor. It does not render the video until the user exports, or asks it to export.
- The assistant does not upload files from the user's computer. It adds media from web addresses.
- Without
chatSessionId, the conversation is kept in the browser only. See Conversation history.