SDKsiOS
Create an audio message from a local path
Create an audio message from an absolute path with OpenIM iOS SDK.
Invoke createSoundMessageFromFullPath:duration: on OIMMessageInfo to construct an audio message from an absolute file path in the local application sandbox. The SDK automatically uploads the audio file to object storage during message dispatch:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
soundPath | NSString * | Yes | Absolute path to the audio file within the application sandbox. |
duration | NSInteger | Yes | Audio playback duration in seconds. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createSoundMessageFromFullPath:audioURL.path
duration:durationSeconds];Return value
Returns an initialized OIMMessageInfo model with its content type set to audio.
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 file upload and deliver the message. If the audio file is already uploaded to remote storage, use Create an audio message from a URL.
Was this page helpful?