nativescript-azure-cognitiveservices
azure-cognitiveservices NativeScript 插件。
npm i --save nativescript-azure-cognitiveservices
- 版本:1.0.1
- GitHub: https://github.com/jibon57/nativescript-azure-cognitiveservices
- NPM: https://npmjs.net.cn/package/nativescript-azure-cognitiveservices
- 下载次数
- 昨天:0
- 上周:1
- 上个月:5
nativescript-azure-cognitiveservices
Azure 认知服务 NativeScript 实现。支持 iOS 和 Android 平台。
特性
- 语音转文本
- 文本转语音
- WAV 录音器
注意:当您使用此服务时,界面将保持阻塞,直到返回任何结果。我建议使用 NativeScript Worker Loader 在后台运行服务
安装
tns plugin add nativescript-azure-cognitiveservices
用法(请查看示例项目以获取详细信息)
导入
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");
}
函数
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>;
需要权限
Android
<uses-permission android:name="android.permission.RECORD_AUDIO" />
iOS
<key>NSMicrophoneUsageDescription</key>
<string>Recording Practice Sessions</string>