Check speech-to-text availability
Query supported audio formats, sample rates, and limits for the speech-to-text engine.
Speech-to-text transcription is a Commercial Edition capability. Prior to exposing a transcription button or capturing audio for transcription, invoke getSpeechToTextCapabilities() to query the formats and size limits supported by the backend speech service. This method accepts no parameters.
Code example
import { getSpeechToTextCapabilities } from '@/uni_modules/unix-openim-sdk'
const capabilities = await getSpeechToTextCapabilities()
if (capabilities == null) {
disableSpeechToText()
}Return value
The Promise resolves with an OpenIMSpeechToTextCapabilitiesResult | null object:
| Field | Type | Description |
|---|---|---|
format | string[] | null | Audio container and codec formats supported by the service (for example, ['m4a', 'wav']). |
sampleRateHz | number[] | null | List of supported sample rates in Hertz. |
maxRecordTimeMs | number | null | Maximum allowable recording duration in milliseconds. |
maxFileSize | number | null | Maximum audio file size in bytes. |
provider | string | null | Active transcription provider identifier. |
requestType | string | null | Protocol request type used by the transcription engine. |
crossDomain | boolean | null | Whether the provider supports cross-domain requests. |
All fields are optional in the public type declarations. Validate only those restrictions explicitly returned by the server. When the call returns null, fails, or lacks critical capabilities, hide or disable the transcription entry point rather than guessing support boundaries.
State changes after the call
This call is a read-only capability query and does not record audio, transcribe speech, or emit message events.
Was this page helpful?