Fun-ASR-Realtime HarmonyOS SDK
Prerequisites
-
Obtain and configure an API key. Do not hardcode a long-lived API key in a mobile app. We recommend generating a temporary API key on your application server and sending it to the client.
-
Download the latest SDK package. Extract the package, copy
entry/libs/neonui.harto theentry/libsdirectory of your application, and add the dependency toentry/oh-package.json5:{ "dependencies": { "neonui": "file:libs/neonui.har" } }For a HarmonyOS C++ integration, use the shared libraries in
native/libsand the header files innative/include. -
Declare network and microphone permissions in the application
module.json5file, and request microphone permission at runtime.reason_internetandreason_microphoneare example resource names. Define the corresponding descriptions in your application resources."requestPermissions": [ { "name": "ohos.permission.INTERNET", "reason": "$string:reason_internet", "usedScene": { "abilities": ["EntryAbility"], "when": "always" } }, { "name": "ohos.permission.MICROPHONE", "reason": "$string:reason_microphone", "usedScene": { "abilities": ["EntryAbility"], "when": "always" } } ]
Quick start
Open the sample project from the SDK package in DevEco Studio. The sample page is entry/src/main/ets/pages/dashscope/DashFunAsrSpeechTranscriberPage.ets. Configure an API key and run the project.
Use model fun-asr-realtime in the example.