Azure cognitive services implementation for NativeScript. Both iOS & Android platfroms are supported.
Features:
- Speech to Text
- Text to Speech
- WAV recorder
Note: When you will use this service that time UI will keep block until any result will come. I'll recommend to use NativeScript Worker Loader to run the service in background
tns plugin add nativescript-azure-cognitiveservices
Import
JavaScript:
var azure = require("nativescript-azure-cognitiveservices");
var azureService = new azure.AzureCognitiveservices("API_KEY", "Region");
TS:
import { AzureCognitiveservices, SpeechSynthesisResult, SpeechToTextResult } from "nativescript-azure-cognitiveservices";
constructor() {
this.azureService = new AzureCognitiveservices("API_KEY", "Region");
}
Functions
speechSynthesis(contents: any, voiceName?: string): any;
speechToTextRecognizeOnce(audioFile?: string, recognitionLanguage?: string): any;
startContinuousRecognition(recognitionLanguage?: string): any;
stopContinuousRecognition(): void;
startRecorder(fileName?: string): void;
stopRecorder(): any;
audioDataSaveAsMP3(audioData: any, fileName?: string): Promise<string>;
Require Permission:
Android:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
iOS:
<key>NSMicrophoneUsageDescription</key>
<string>Recording Practice Sessions</string>