8000 fix(initSpeech): scope click listener to one-off, namespaced handler to avoid external UI conflicts by amartincua · Pull Request #617 · ableplayer/ableplayer · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build/ableplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7723,14 +7723,14 @@ var AblePlayerInstances = [];
// handle a click on anything, in case the user
// clicks something before they click 'play' or 'prefs' buttons
// that would allow us to init speech before it's needed
$(document).on('click',function() {
$(document).on('click.ableInitSpeech', function () {
var greeting = new SpeechSynthesisUtterance('Hi!');
greeting.volume = 0; // silent
greeting.rate = 10; // fastest speed supported by the API
thisObj.synth.speak(greeting);
greeting.onstart = function(e) {
// utterance has started
$(document).off('click'); // unbind the click event listener
$(document).off('click.ableInitSpeech'); // unbind the click event listener
}
greeting.onend = function(e) {
// should now be able to get browser voices
Expand All @@ -7756,7 +7756,7 @@ var AblePlayerInstances = [];
thisObj.synth.speak(greeting);
greeting.onstart = function(e) {
// utterance has started
$(document).off('click'); // unbind the click event listener
$(document).off('click.ableInitSpeech'); // unbind the click event listener
};
greeting.onend = function(e) {
// should now be able to get browser voices
Expand Down
0