SDKsWASM
Create a video message from URLs
Create a video message from uploaded video and thumbnail resources with the WASM SDK.
createVideoMessageByURL() creates a message from an uploaded video and its video thumbnail. The SDK field names retain snapshot, while this page uses “video thumbnail” for the user-facing concept.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | string | Yes | Local filename or application-defined path of the video file. Pass an empty string when only a remote resource is available. |
duration | number | Yes | Video duration in seconds. |
videoType | string | Yes | Video MIME type. |
videoUUID | string | Yes | Unique identifier for the video resource. |
videoUrl | string | Yes | Accessible URL of the uploaded video. |
videoSize | number | Yes | Video size in bytes. |
snapshotPath | string | Yes | Local filename or application-defined path of the thumbnail file. Pass an empty string when only a remote resource is available. |
snapshotUUID | string | Yes | Unique identifier for the thumbnail resource. |
snapshotSize | number | Yes | Thumbnail size in bytes. |
snapshotUrl | string | Yes | Accessible URL of the uploaded thumbnail. |
snapshotWidth | number | Yes | Thumbnail width in pixels. |
snapshotHeight | number | Yes | Thumbnail height in pixels. |
snapShotType | string | No | Thumbnail MIME type. |
const { data: message } = await openimsdk.createVideoMessageByURL({
videoPath: '',
duration,
videoType: uploadedVideo.contentType,
videoUUID: crypto.randomUUID(),
videoUrl: uploadedVideo.url,
videoSize: uploadedVideo.size,
snapshotPath: '',
snapshotUUID: crypto.randomUUID(),
snapshotSize: uploadedSnapshot.size,
snapshotUrl: uploadedSnapshot.url,
snapshotWidth,
snapshotHeight,
snapShotType: uploadedSnapshot.contentType,
});Pass the video duration in seconds. When the Promise resolves, it has created only a pending message object. Send it with sendMessageNotOss().
Was this page helpful?