SDKsuni-app
Create an audio message from a URL
OpenIM uni-app / uni-app x SDK guide for Create an audio message from a URL.
createSoundMessageByURL() creates a message from already uploaded audio metadata.
Parameters
| Parameter | Type | Description |
|---|---|---|
uuid | string or null | Unique audio resource ID. |
soundPath | string or null | Local name or business path; use an empty string for a remote-only resource. |
sourceUrl | string or null | Accessible uploaded audio URL. |
dataSize | number or null | Audio size in bytes. |
duration | number or null | Duration in the unit defined by the server protocol. |
import { createSoundMessageByURL } from '@/uni_modules/unix-openim-sdk'
const message = await createSoundMessageByURL({
uuid: createBusinessUUID(),
soundPath: '',
sourceUrl: uploaded.url,
dataSize: uploaded.size,
duration,
})Use upload-result URL, UUID, size, and duration values. The remote resource must be accessible to recipients; a sandbox path is not a media URL. OpenIMSoundElem does not contain the Wasm soundType field. The Promise only creates a message; send it with sendMessageNotOss().
Was this page helpful?