Browse SDKs · React Native
SDKsReact Native

Create a video message from URLs

OpenIM React Native SDK guide for create a video message from urls.

Copy

Use createVideoMessageByURL() to create a message from uploaded video and cover-image 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 an empty string when only a remote resource is available.
durationnumberYesVideo duration in seconds.
videoTypestringYesVideo type.
videoUUID, videoUrl, videoSizestring, string, numberYesVideo resource ID, remote URL, and byte size.
snapshotPathstringYesLocal cover-image path. Pass an empty string when only a remote resource is available.
snapshotUUID, snapshotUrl, snapshotSizestring, string, numberYesCover-image resource ID, remote URL, and byte size.
snapshotWidth, snapshotHeightnumberYesCover-image width and height in pixels.
snapShotTypestringNoCover-image type.

The call returns a MessageItem ready to send. Use Send an uploaded media message to send it.