7

この質問は、のCordova/PhoneGap/Hybrid用です。Cordova:音声ディクテーションがiOSで終了したかどうかを検出する方法はありますか

私は<textarea>を持っています。これは、音声ディクテーションの入力が終了したとき、つまりユーザーのタブが「完了」したときのみアプリが一定の動作をしたいようにします。しかし、これはかなり困難であることが判明している。

iOSのUIKitはのイベントをUITextInputに提供しますが、これをハイブリッドアプリでも使用できるかどうかはわかりません。 (iOSデベロッパーライブラリdoc here

編集:私はionic-plugin-keyboardを使用しています。

アイデアをいただければ幸いです。

SpeechBegin 
SpeechEnd 
SpeechCancel 
SpeechResults 
SpeechError 
VolumeChanged 

SpeakBegin 
SpeakPaused 
SpeakResumed 
SpeakCancel 
SpeakCompleted 
SpeakProgress 
BufferProgress 

とをサポートしています:

答えて

4

たぶん、あなたはあなたのようなiOSデバイスで音声コントロールのコントロールを持っている13回のイベントを持っているcordova-plugin-iflyspeechについてSpeechRecognitionPluginまたはcordova-plugin-iflyspeech

を使用しようとすることができます

これはドキュメントの例です。

(英語)のような多くの言語が英語で表示されています(英語、英国、フランス語、スペイン語、イタリア語など)。アクションを依存し、 stopListening();または cancelListening();方法:0
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(); 
} 

そして、ここでは、あなたがにiOSの方法dictationRecordingDidEndをバインドすることができます。

+2

私はcordova-plugin-iflyspeechプラグインもお勧めします。 –

関連する問題