Maybe you can try to use the SpeechRecognitionPlugin or cordova-plugin-iflyspeech
For the cordova-plugin-iflyspeech
you have 13 events to have control of the voice control in your iOS device like:
SpeechBegin
SpeechEnd
SpeechCancel
SpeechResults
SpeechError
VolumeChanged
SpeakBegin
SpeakPaused
SpeakResumed
SpeakCancel
SpeakCompleted
SpeakProgress
BufferProgress
And has support for a big number of languages like: English (US), English (UK), French, Spanish, Italian, etc.
This is an example of the documentation
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();
}
And here you can bind the iOS method dictationRecordingDidEnd
to:
stopListening();
or cancelListening();
methods, depending the action.