Creating videos
Apps can add videos to a user's design, such as MP4 and MOV files. The user can arrange these videos in a Canva design or splice them together in Canva's video editor.
To add videos from third-party sources, such as YouTube, see Embedding rich media.
The user experience
When an app adds a video to the user's design, the video file is uploaded to the user's media library.
While the video is uploading, a lower-resolution version of the video is shown to the user. If the user hasn't provided a lower-resolution version, a static image is shown as a fallback.
The user's media library has a storage quota. If the user has a Canva Pro(opens in a new tab or window) account, their storage quota is 1TB. Otherwise, their storage quota is 5GB. If the user exceeds the storage quota, they'll see an error.
Once the video exists in the user's design, the video is indistinguishable from videos added via Canva's native features. This means the user can manipulate the video in all the same ways, including:
- Adjusting the size, position, and rotation of the video
- Applying effects to the video
- Using the video as a background
- Animating the video — for example, having it fade in
Supported video types
Apps can add the following types of videos to a user's design:
Name | MIME type | Common file extensions |
---|---|---|
AVI | video/avi | .avi |
GIF | image/gif | .gif |
Lottie | application/json | .json |
M4V | video/x-m4v | .m4v |
Matroska | video/x-matroska | .mkv |
QuickTime | video/quicktime | .mov |
MP4 | video/mp4 | .mp4 |
MPEG | video/mpeg | .mpg, .mpeg |
WebM | video/webm | .webm |
The maximum allowed file size is 100MB — except for Lottie files, which are limited to 0.5MB.
Lottie file limitations
If you're uploading Lottie(opens in a new tab or window) files, the following limitations apply:
- The maximum allowed size of Lottie files is 0.5MB (500KB).
- Lottie stickers must not exceed 10 seconds or 2048 x 2048 pixels.
- Lottie stickers must not contain:
- 3D layers
- Font references
- Media assets
- Property expressions
- Lottie compositions must not contain:
- 3D layers
- Audio
- Gradient stroke shapes
- Images
- Solids
- Star shapes
- Text
- Time remapping
- Time stretching
Under the hood, Canva uses the Lottie Light(opens in a new tab or window) version of Lottie for Web(opens in a new tab or window).
How to create videos
Step 1: Enable the required permissions
In the Developer Portal, enable the following permissions:
canva:design:content:write
canva:asset:private:write
In the future, the Apps SDK will throw an error if the required permissions are not enabled.
To learn more, see Configuring permissions.
Step 2: Upload a video file
Import the upload
method from the @canva/asset
package:
import { upload } from "@canva/asset";
Call the method, passing in the options shown here:
const result = await upload({type: "video",mimeType: "video/mp4",url: "https://www.canva.dev/example-assets/video-import/video.mp4",thumbnailImageUrl:"https://www.canva.dev/example-assets/video-import/thumbnail-image.jpg",thumbnailVideoUrl:"https://www.canva.dev/example-assets/video-import/thumbnail-video.mp4",aiDisclosure: "none",});
When uploading videos, the URLs must be exposed via the internet and available to Canva's backend, as Canva needs access to the URLs to download them. This means you can't use localhost
URLs.
The upload
method returns an object that contains a ref
property:
console.log(result.ref);
This property contains a reference, which is a unique identifier that points to a video asset in Canva's backend. An app can use this reference to interact with the file — even while it's uploading.
Step 3: Add the video to the design
Import the addElementAtPoint
method (or addElementAtCursor
, depending on the current context) from the @canva/design
package:
import { addElementAtPoint } from "@canva/design";
Call the method, passing in the options shown here:
await addElementAtPoint({type: "video",ref: result.ref,altText: {text: "Video description for accessibility",decorative: false},});
Additional considerations
- All videos must comply with Canva's Acceptable Use Policy(opens in a new tab or window).
- All videos must comply with Canva's Upload formats and requirements(opens in a new tab or window).
API reference
Code sample
import React from "react";import { addElementAtPoint } from "@canva/design";import { upload } from "@canva/asset";export function App() {async function handleClick() {// Upload a video fileconst result = await upload({type: "video",mimeType: "video/mp4",url: "https://www.canva.dev/example-assets/video-import/video.mp4",thumbnailImageUrl:"https://www.canva.dev/example-assets/video-import/thumbnail-image.jpg",thumbnailVideoUrl:"https://www.canva.dev/example-assets/video-import/thumbnail-video.mp4",aiDisclosure: "none",});// Add the video to the designawait addElementAtPoint({type: "video",ref: result.ref,altText: {text: "Video description for accessibility",decorative: false},});}return (<div><button onClick={handleClick}>Add video to design</button></div>);}