Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cordova Ionic原生插件文本到语音_Cordova_Angular_Ionic Framework - Fatal编程技术网

Cordova Ionic原生插件文本到语音

Cordova Ionic原生插件文本到语音,cordova,angular,ionic-framework,Cordova,Angular,Ionic Framework,我有一个非常简单的问题要问。我想说另一种语言,然后就默认的英语。我查看了官方页面,但我真的不知道如何在使用代码中应用它 用法: import { TextToSpeech } from '@ionic-native/text-to-speech'; constructor(private tts: TextToSpeech) { } ... this.tts.speak('Hello World') .then(() => console.log('Success')) .c

我有一个非常简单的问题要问。我想说另一种语言,然后就默认的英语。我查看了官方页面,但我真的不知道如何在使用代码中应用它

用法:

import { TextToSpeech } from '@ionic-native/text-to-speech';

constructor(private tts: TextToSpeech) { }

...

this.tts.speak('Hello World')
  .then(() => console.log('Success'))
  .catch((reason: any) => console.log(reason));
下面是我想添加到使用代码中的选项。

只需将tts选项传递给speak()函数:

this.tts.speak({
  text: "Hello world",
  locale: "en-US" // Pass any locale you want here.
}).then(() => console.log('Success'))
  .catch((reason: any) => console.log(reason));