SDKsiOS
Create an audio message from a URL
Create an audio message from a previously uploaded URL with OpenIM iOS SDK.
When the application has already uploaded audio recordings to an external server or object storage, invoke createSoundMessageByURL:duration:size: on OIMMessageInfo to construct an audio message object directly without redundant uploads by the SDK:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
soundURL | NSString * | Yes | Accessible remote URL of the uploaded audio file. |
duration | NSInteger | Yes | Audio playback duration in seconds. |
size | NSInteger | Yes | Actual size of the audio file in bytes. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createSoundMessageByURL:uploadedURL
duration:durationSeconds
size:uploadedSize];Return value
Returns an initialized OIMMessageInfo model populated with the remote audio URL and metadata. The passed URL, duration, and file size must match valid asset data.
State changes after the call
- Local memory instantiation: This method constructs an in-memory message object without writing to the database or initiating network activity.
- Subsequent dispatch: Because the audio file is already hosted externally, deliver the message by calling Send a message without SDK-managed upload. If you need the SDK to manage local audio uploading, use Create an audio message from a local path.
Was this page helpful?