nativescript-azure-cognitiveservices
azure-cognitiveservices NativeScript plugin.
npm i --save nativescript-azure-cognitiveservices

npm npm

nativescript-azure-cognitiveservices

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

Installation

tns plugin add nativescript-azure-cognitiveservices

Usage (Please check demo project for details)

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>