| class info |
| com.huawei.hms.mlsdk.aft.cloud.MLRemoteAftEngine |
| Audio transcription engine on the cloud. |
| Return type | Method name |
| void | close() |
| MLRemoteAftEngine | getInstance() |
| void | init(android.content.Context context) |
| void | setAftListener(MLRemoteAftListener listener) |
| String | shortRecognize(android.net.Uri uri, MLRemoteAftSetting setting) |
| Method |
| public void close() |
| Disables the audio transcription engine to release engine resources. |
| Method |
| public static MLRemoteAftEngine getInstance() |
| Obtains an audio transcription engine instance on the cloud. |
Parameters
| Parameter name | Parameter desc |
| MLRemoteAftEngine | Audio transcription engine instance on the cloud. |
| Method |
| public void init(android.content.Context context) |
| Initializes the audio transcription engine on the cloud and loads engine resources. |
Parameters
| Parameter name | Parameter desc |
| context | Context. |
| Method |
| public void setAftListener(MLRemoteAftListener listener) |
| Sets the audio transcription listener on the cloud. |
Parameters
| Parameter name | Parameter desc |
| listener | Audio transcription listener instance on the cloud. |
| Method |
| public String shortRecognize(android.net.Uri uri, MLRemoteAftSetting setting) |
| Converts a short audio file on the cloud. |
Parameters
| Parameter name | Parameter desc |
| uri | Audio file URI. Only local audio files are supported. The value can start with content:// or file://. |
| setting | Audio transcription settings on the cloud. |
Return
| Type | desc |
| String | ID of the audio transcription task. |
Sample Code
- MLRemoteAftEngine engine = MLRemoteAftEngine.getInstance();
- // Initialize the engine and pass the current context.
- engine.init(this);
- MLRemoteAftSetting setting = new MLRemoteAftSetting.Factory()
- .setLanguageCode("zh")
- .create();
- // Pass the listener callback (aftListener) to the audio transcription engine.
- engine.setAftListener(aftListener);