WeaveVideoToolAction
Add a video to the canvas
Overview
The WeaveVideoToolAction class that enables users to insert video nodes into the canvas. It provides an intuitive way to add visual content—either by selecting a video file, dragging and dropping, or integrating with an video picker—allowing users to enhance their collaborative workspace with rich media.
Each interaction results in the creation of a WeaveVideoNode, which can be resized, moved, and synchronized across all connected users.
The class extends the WeaveAction class.
Name
This action name
property value is videoTool
.
Import
import { WeaveVideoToolAction } from "@inditextech/weave-sdk";
Instantiation
new WeaveVideoToolAction();
TypeScript types
type WeaveVideoToolActionStateKeys = keyof typeof VIDEO_TOOL_STATE;
type WeaveVideoToolActionState =
(typeof VIDEO_TOOL_STATE)[WeaveVideoToolActionStateKeys];
type WeaveVideoToolDragParams = {
placeholderUrl: string;
url: string;
width: number;
height: number;
};
type WeaveVideoToolActionTriggerParams = {
videoId?: string;
videoParams?: WeaveVideoToolDragParams;
position?: Vector2d;
forceMainContainer?: boolean;
};
type WeaveVideoToolActionTriggerVideoParams = {
videoPlaceholderURL: string;
videoURL: string;
};
type WeaveVideoToolActionTriggerReturn =
| {
finishUploadCallback: (
videoParams: WeaveVideoToolDragParams,
position?: Vector2d
) => void;
}
| undefined;
type WeaveVideoToolActionOnAddingEvent = { videoURL: string };
type WeaveVideoToolActionOnAddedEvent = {
videoURL: string;
nodeId: string;
};
Trigger function params
trigger(cancelAction: () => void, params?: WeaveVideoToolActionTriggerParams): WeaveVideoToolActionTriggerReturn
For WeaveVideoToolActionTriggerParams
:
Prop | Type | Default |
---|---|---|
forceMainContainer? | boolean | - |
position? | Vector2d | - |
videoParams? | WeaveVideoToolDragParams | - |
videoId? | string | - |
Events
onAddingVideo
onAddingVideo: WeaveNodesSelectionPluginOnNodesChangeEvent;
The onAddingVideo
event is called when the tool is ready to add a video.
onAddedVideo
onAddedVideo: WeaveVideoToolActionOnAddedEvent;
The onAddedVideo
event is called when the video has been added to the canvas.