我对react-native-voice和react-native-tts有一个问题,在与用户界面交互后,声音输出已更改为内部扬声器,并且声音非常安静。也许有人也有同样的问题,他知道如何在iOS中控制声音输出。
谢谢。
async _startRecognition(e) {
if (Voice.isRecognizing()) return;
this.resetSpeechState();
try {
await Voice.start('en-GB');
} catch (e) {
console.error(e);
}
}
handleSpeak = (text) => {
if (this.state.speaking) return false;
Tts.getInitStatus().then(() => {
Tts.speak(text);
});
}发布于 2019-05-21 14:16:04
在新的npm/yarn版本推出之前,
这是一个临时解决方案。
如果同时使用react-native-voice和react-native-tts,那么react-native-voice将会产生冲突。他们已经在他们的主分支中修复了这个问题,你必须从那里提取Voice.m并粘贴到你的node_module包中。首先转到react-native-voice github,单击下面的链接查看Voice.m主分支代码https://github.com/wenkesj/react-native-voice/blob/ae01a0876e2a9635ae4047dd230f5e7ef2d00672/ios/Voice/Voice.m并复制完整代码,然后转到您的node_nodules github并替换整个本地代码,保存。运行你的项目,它现在应该可以工作了。
https://stackoverflow.com/questions/53941500
复制相似问题