SDKsReact Native
Create video message from file
Construct a video message from a local video file and snapshot using the OpenIM React Native SDK.
Construct a video message using local video and snapshot thumbnail files on the device filesystem:
const message = await OpenIMSDK.createVideoMessageFromFullPath({
videoPath,
videoType: 'video/mp4',
duration: 36,
snapshotPath,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | string | Yes | Absolute local filesystem path to the video file. |
videoType | string | Yes | Video MIME type (e.g. 'video/mp4'). |
duration | number | Yes | Video playback duration in seconds. |
snapshotPath | string | Yes | Absolute local filesystem path to the cover snapshot image. |
Return value
A resolved Promise returns the initialized MessageItem object with video and cover metadata 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 message to deliver it to a conversation; the SDK automatically uploads the local video and thumbnail files during transmission.
Was this page helpful?