Browse SDKs · iOS
Platform
SDKsiOS

Create a video message from a local path

Create a video message from an absolute path with OpenIM iOS SDK.

Copy

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

ParameterTypeRequiredDescription
videoPathNSString *YesAbsolute path to the video file within the application sandbox.
videoTypeNSString *YesVideo MIME or container type (e.g. video/mp4).
durationNSIntegerYesVideo playback duration in seconds.
snapshotPathNSString *YesAbsolute 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

  1. Local memory instantiation: This method builds an in-memory message model without persisting records to local storage or initiating network uploads immediately.
  2. 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.