SDKsiOSEnterprise
Transcribe audio
Transcribe audio to text through OpenIMCore on iOS.
On native iOS, prefer placing a readable sandboxed audio path in filename. If a path cannot be provided, place Base64-encoded audio in data:
NSDictionary *request = @{@"filename": audioFileURL.path};
NSString *requestJSON = [self JSONString:request];
CallbackProxy *callback = [[CallbackProxy alloc]
initWithOnSuccess:^(NSString *data) {
[self showTranscription:[self textFromResultJSON:data]];
}
onFailure:nil];Pass requestJSON and the callback to Open_im_sdkSpeechToText. The success JSON has the shape { "text": string }. It does not modify the source message or trigger a message event. Check speech-recognition support before calling.
Was this page helpful?