Sometimes the speech-to-text outputs "Pause." and "Stop." instead of "Pause" and "Stop". The periods at the end of the words cause the plugin not to recognize them. This can be corrected with the following changes:
// if (final_transcript.toLowerCase() == CN_SAY_THIS_WORD_TO_STOP) {
if (final_transcript.toLowerCase() == CN_SAY_THIS_WORD_TO_STOP || final_transcript.toLowerCase().slice(0, -1) == CN_SAY_THIS_WORD_TO_STOP) {
// if (final_transcript.toLowerCase() == CN_SAY_THIS_WORD_TO_PAUSE) {
if (final_transcript.toLowerCase() == CN_SAY_THIS_WORD_TO_PAUSE || final_transcript.toLowerCase().slice(0, -1) == CN_SAY_THIS_WORD_TO_PAUSE) {
Sometimes the speech-to-text outputs "Pause." and "Stop." instead of "Pause" and "Stop". The periods at the end of the words cause the plugin not to recognize them. This can be corrected with the following changes: