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.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | string | Yes | Local video path; pass empty string "" when using remote-only assets. |
duration | number | Yes | Video playback duration in seconds. |
videoType | string | Yes | Video MIME type (e.g. 'video/mp4'). |
videoUUID | string | Yes | Unique resource identifier for the video asset. |
videoUrl | string | Yes | Remote network URL where the video file is hosted. |
videoSize | number | Yes | Video file size in bytes. |
snapshotPath | string | Yes | Local thumbnail path; pass empty string "" when using remote-only assets. |
snapshotUUID | string | Yes | Unique resource identifier for the thumbnail asset. |
snapshotUrl | string | Yes | Remote network URL where the thumbnail snapshot is hosted. |
snapshotSize | number | Yes | Thumbnail file size in bytes. |
snapshotWidth | number | Yes | Width of the snapshot in pixels. |
snapshotHeight | number | Yes | Height of the snapshot in pixels. |
snapShotType | string | No | Thumbnail 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.
Was this page helpful?