SDKsWASM
Create a video message from URLs
Create a video message from uploaded video and snapshot resources with the WASM SDK.
createVideoMessageByURL() creates a message from information for video and snapshot resources that have already been uploaded.
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. |
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 snapshot file. Pass an empty string when only a remote resource is available. |
snapshotUUID | string | Yes | Unique identifier for the snapshot resource. |
snapshotSize | number | Yes | Snapshot size in bytes. |
snapshotUrl | string | Yes | Accessible URL of the uploaded snapshot. |
snapshotWidth | number | Yes | Snapshot width in pixels. |
snapshotHeight | number | Yes | Snapshot height in pixels. |
snapShotType | string | No | Snapshot 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,
});When the Promise resolves, it has created only a pending message object. Send it with sendMessageNotOss().
Was this page helpful?