SDKsiOS
Create a video message from a local path
Create a video message from an absolute path with OpenIM iOS SDK.
Invoke createVideoMessageFromFullPath:videoType:duration:snapshotPath: on OIMMessageInfo to construct a video message from absolute file paths in the local application sandbox. The SDK automatically uploads both the video file and its thumbnail image during message dispatch:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoPath | NSString * | Yes | Absolute path to the video file within the application sandbox. |
videoType | NSString * | Yes | Video MIME or container type (e.g. video/mp4). |
duration | NSInteger | Yes | Video playback duration in seconds. |
snapshotPath | NSString * | Yes | Absolute path to the video thumbnail image within the application sandbox. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createVideoMessageFromFullPath:videoURL.path
videoType:@"video/mp4"
duration:durationSeconds
snapshotPath:snapshotURL.path];Return value
Returns an initialized OIMMessageInfo model with its content type set to video.
State changes after the call
- Local memory instantiation: This method builds an in-memory message model without persisting records to local storage or initiating network uploads immediately.
- Subsequent dispatch: Call Send a message to execute media upload and deliver the message. If the video and thumbnail are already uploaded to remote storage, use Create a video message from a URL.
Was this page helpful?