Browse SDKs · WASM
SDKsWASM

Create a video message from URLs

Create a video message from uploaded video and snapshot resources with the WASM SDK.

Copy

createVideoMessageByURL() creates a message from information for video and snapshot resources that have already been uploaded.

Parameters

ParameterTypeRequiredDescription
videoPathstringYesLocal filename or application-defined path of the video file. Pass an empty string when only a remote resource is available.
durationnumberYesVideo duration.
videoTypestringYesVideo MIME type.
videoUUIDstringYesUnique identifier for the video resource.
videoUrlstringYesAccessible URL of the uploaded video.
videoSizenumberYesVideo size in bytes.
snapshotPathstringYesLocal filename or application-defined path of the snapshot file. Pass an empty string when only a remote resource is available.
snapshotUUIDstringYesUnique identifier for the snapshot resource.
snapshotSizenumberYesSnapshot size in bytes.
snapshotUrlstringYesAccessible URL of the uploaded snapshot.
snapshotWidthnumberYesSnapshot width in pixels.
snapshotHeightnumberYesSnapshot height in pixels.
snapShotTypestringNoSnapshot 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().