Browse SDKs · React Native
Platform
SDKsReact Native

Create video message from URL

Construct a video message using pre-uploaded remote video and thumbnail URLs using the OpenIM React Native SDK.

Copy

Construct a video message using remote metadata from pre-uploaded video and thumbnail resources:

const message = await OpenIMSDK.createVideoMessageByURL({
  videoPath: '',
  duration: 36,
  videoType: 'video/mp4',
  videoUUID: 'video-001',
  videoUrl: 'https://www.example.com/video.mp4',
  videoSize: 820000,
  snapshotPath: '',
  snapshotUUID: 'cover-001',
  snapshotSize: 42000,
  snapshotUrl: 'https://www.example.com/snapshot.png',
  snapshotWidth: 1280,
  snapshotHeight: 720,
  snapShotType: 'image/jpeg',
});

Parameters

ParameterTypeRequiredDescription
videoPathstringYesLocal video path; pass empty string "" when using remote-only assets.
durationnumberYesVideo playback duration in seconds.
videoTypestringYesVideo MIME type (e.g. 'video/mp4').
videoUUIDstringYesUnique resource identifier for the video asset.
videoUrlstringYesRemote network URL where the video file is hosted.
videoSizenumberYesVideo file size in bytes.
snapshotPathstringYesLocal thumbnail path; pass empty string "" when using remote-only assets.
snapshotUUIDstringYesUnique resource identifier for the thumbnail asset.
snapshotUrlstringYesRemote network URL where the thumbnail snapshot is hosted.
snapshotSizenumberYesThumbnail file size in bytes.
snapshotWidthnumberYesWidth of the snapshot in pixels.
snapshotHeightnumberYesHeight of the snapshot in pixels.
snapShotTypestringNoThumbnail MIME type (e.g. 'image/jpeg').

Return value

A resolved Promise returns the initialized MessageItem object with remote video and thumbnail attributes stored in videoElem.

This method builds the message structure strictly in client memory; it does not dispatch messages to the server or trigger lifecycle events. After initialization, invoke Send uploaded media message to deliver it to a conversation without repeating file uploads.