convert method
Upload filePath then convert the uploaded URL to text.
Returns VoiceToTextSuccess when both steps succeed and the converted text is non-empty. Returns VoiceToTextFailure on any error, empty text, or overall timeout (defaults to 30 seconds).
Implementation
Future<VoiceToTextResult> convert(String filePath) async {
try {
return await _runPipeline(filePath).timeout(
_timeout,
onTimeout: () => const VoiceToTextFailure(
code: -1,
message: 'voice-to-text timeout',
isTimeout: true,
),
);
} catch (e) {
return VoiceToTextFailure(code: -1, message: e.toString());
}
}