Gol*_*enD 7 ios phonegap-plugins cordova hybrid-mobile-app cordova-plugins
请注意,这个问题适用于Cordova/PhoneGap/Hybrid应用程序.
我有一个<textarea>我希望应用程序只有在语音听写输入结束时才以某种方式运行 - 即用户选项卡"完成".然而,这被证明是相当困难的.
iOS UIKit提供了下面的dictationRecordingDidEnd活动,UITextInput但我不确定这是否可以在混合应用程序中使用.(iOS开发库文档在这里)
编辑:我正在使用ionic-plugin-keyboard.
任何想法将不胜感激.
也许您可以尝试使用SpeechRecognitionPlugin或cordova-plugin-iflyspeech
您可以通过cordova-plugin-iflyspeech13 个事件来控制 iOS 设备中的语音控制,例如:
SpeechBegin
SpeechEnd
SpeechCancel
SpeechResults
SpeechError
VolumeChanged
SpeakBegin
SpeakPaused
SpeakResumed
SpeakCancel
SpeakCompleted
SpeakProgress
BufferProgress
Run Code Online (Sandbox Code Playgroud)
并且支持多种语言,例如:英语(美国)、英语(英国)、法语、西班牙语、意大利语等。
这是文档的示例
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
$('div#status').html( 'speech engine ready' );
}
function startReading() {
var text = $('textarea#read').val();
navigator.speech.startSpeaking( text, {voice_name: 'xiaoyan'} );
}
function stopReading() {
navigator.speech.stopSpeaking();
}
function startListening() {
$('div#status').html( 'Listening, please speak.' );
navigator.speech.startListening({language:'en-US'} function(str) {
// this is what the device hear and understand
$('textarea#read').val( str );
});
}
function stopListening() {
navigator.speech.stopListening();
}
Run Code Online (Sandbox Code Playgroud)
在这里,您可以将 iOS 方法绑定dictationRecordingDidEnd到:
stopListening();或cancelListening();方法,具体取决于操作。
| 归档时间: |
|
| 查看次数: |
838 次 |
| 最近记录: |