Browse SDKs · iOS
Platform
SDKsiOS

Create a video message from a URL

Create a video message from a previously uploaded video URL with OpenIM iOS SDK.

Copy

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

ParameterTypeRequiredDescription
videoURLNSString *YesAccessible remote URL of the uploaded video file.
videoTypeNSString *YesVideo MIME type (e.g. video/mp4).
durationNSIntegerYesVideo playback duration in seconds.
sizeNSIntegerYesActual size of the video file in bytes.
snapshotNSString *YesAccessible 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

  1. Local memory instantiation: This method builds an in-memory message object without saving records to local storage or making network requests.
  2. 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.