Skip to content

Commit 0cc2042

Browse files
authored
Merge pull request #24 from TokisakiKurumi2001/master
Add the stop function to p5 speech recognition
2 parents 97c6ba6 + c7c62d9 commit 0cc2042

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/p5.speech.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@
354354
}
355355
};
356356

357+
// Add function to stop the speech recognition from keep listening
358+
p5.SpeechRec.prototype.stop = function() {
359+
if('webkitSpeechRecognition' in window) {
360+
this.rec.stop();
361+
}
362+
};
363+
357364
}));
358365

359366
/*

0 commit comments

Comments
 (0)