SDKsuni-appEnterprise
Transcribe audio
OpenIM uni-app / uni-app x SDK guide for Transcribe audio.
import { speechToText } from '@/uni_modules/unix-openim-sdk'
const result = await speechToText({
filename: 'voice.m4a',
data: audioBase64,
})
if (result?.text != null) setTranscript(result.text)This is Commercial. Native files cannot cross the UTS boundary directly; encode the audio as the commercial service protocol requires. The Promise resolves to OpenIMSpeechToTextResult | null, whose optional text field contains the transcript.
First query speech-to-text capabilities and enforce the supported size, format, sample rate, and duration. Do not log complete audio or Base64 content. Transcription neither edits the original audio message nor emits message events. Ask the user to confirm transcripts before high-risk use; to persist one locally, see Save a local transcript.
Was this page helpful?