SDKsReact Native
Create a video message from URLs
OpenIM React Native SDK guide for create a video message from urls.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | string | Yes | Local video path. Pass an empty string when only a remote resource is available. |
duration | number | Yes | Video duration in seconds. |
videoType | string | Yes | Video type. |
videoUUID, videoUrl, videoSize | string, string, number | Yes | Video resource ID, remote URL, and byte size. |
snapshotPath | string | Yes | Local cover-image path. Pass an empty string when only a remote resource is available. |
snapshotUUID, snapshotUrl, snapshotSize | string, string, number | Yes | Cover-image resource ID, remote URL, and byte size. |
snapshotWidth, snapshotHeight | number | Yes | Cover-image width and height in pixels. |
snapShotType | string | No | Cover-image type. |
The call returns a MessageItem ready to send. Use Send an uploaded media message to send it.
Was this page helpful?