SDKsiOS
Create a video message from a URL
Create a video message from a previously uploaded video URL with OpenIM iOS SDK.
When the application has already uploaded video files and thumbnail snapshots to object storage and holds remote URLs, invoke createVideoMessageByURL:videoType:duration:size:snapshot: on OIMMessageInfo to construct a video message object directly without redundant uploads by the SDK:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoURL | NSString * | Yes | Accessible remote URL of the uploaded video file. |
videoType | NSString * | Yes | Video MIME type (e.g. video/mp4). |
duration | NSInteger | Yes | Video playback duration in seconds. |
size | NSInteger | Yes | Actual size of the video file in bytes. |
snapshot | NSString * | Yes | Accessible remote URL of the uploaded thumbnail snapshot image. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createVideoMessageByURL:videoURL
videoType:@"video/mp4"
duration:durationSeconds
size:videoSize
snapshot:snapshotURL];Return value
Returns an initialized OIMMessageInfo model populated with the remote video and snapshot URLs. The passed URL, duration, file size, and snapshot URL must represent valid remote assets.
State changes after the call
- Local memory instantiation: This method builds an in-memory message object without saving records to local storage or making network requests.
- Subsequent dispatch: Because the media files are already hosted externally, deliver the message by calling Send a message without SDK-managed upload. If you want the SDK to handle local video file and snapshot uploading, use Create a video message from a local path.
Was this page helpful?