Browse SDKs · React Native
Platform
SDKsReact Native

Create video message from file

Construct a video message from a local video file and snapshot using the OpenIM React Native SDK.

Copy

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

ParameterTypeRequiredDescription
videoPathstringYesAbsolute local filesystem path to the video file.
videoTypestringYesVideo MIME type (e.g. 'video/mp4').
durationnumberYesVideo playback duration in seconds.
snapshotPathstringYesAbsolute 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.