Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
additional condition to test for descVoices array in the initSpeech f…
…unction
  • Loading branch information
jeanem committed Jun 26, 2024
commit a7d8dc152d81f6603878cf9a25e9422fa405bd4a
7 changes: 6 additions & 1 deletion build/ableplayer.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -7703,7 +7703,10 @@ var AblePlayerInstances = [];
thisObj.synth.speak(greeting);
greeting.onend = function () {
thisObj.getBrowserVoices();
if (thisObj.descVoices.length || context !== "init") {
if (
(Array.isArray(thisObj.descVoices) && thisObj.descVoices.length) ||
context !== "init"
) {
thisObj.speechEnabled = true;
}
};
Expand All @@ -7724,6 +7727,8 @@ var AblePlayerInstances = [];
this.synth.cancel(); // Cancel any ongoing speech synthesis

if (context === "init") {
// Attempt to enable speech synthesis directly for browsers that don't require a click
attemptEnableSpeech();
// For initial setup, require a user click to enable speech synthesis
// Scoping to a particular handler to avoid conflicts with other click events
$(document).on("click", handleInitialClick);
Expand Down
7 changes: 6 additions & 1 deletion build/ableplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7703,7 +7703,10 @@ var AblePlayerInstances = [];
thisObj.synth.speak(greeting);
greeting.onend = function () {
thisObj.getBrowserVoices();
if (thisObj.descVoices.length || context !== "init") {
if (
(Array.isArray(thisObj.descVoices) && thisObj.descVoices.length) ||
context !== "init"
) {
thisObj.speechEnabled = true;
}
};
Expand All @@ -7724,6 +7727,8 @@ var AblePlayerInstances = [];
this.synth.cancel(); // Cancel any ongoing speech synthesis

if (context === "init") {
// Attempt to enable speech synthesis directly for browsers that don't require a click
attemptEnableSpeech();
// For initial setup, require a user click to enable speech synthesis
// Scoping to a particular handler to avoid conflicts with other click events
$(document).on("click", handleInitialClick);
Expand Down
2 changes: 1 addition & 1 deletion build/ableplayer.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion scripts/description.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@
thisObj.synth.speak(greeting);
greeting.onend = function () {
thisObj.getBrowserVoices();
if (thisObj.descVoices.length || context !== "init") {
if (
(Array.isArray(thisObj.descVoices) && thisObj.descVoices.length) ||
context !== "init"
) {
thisObj.speechEnabled = true;
}
};
Expand All @@ -184,6 +187,8 @@
this.synth.cancel(); // Cancel any ongoing speech synthesis

if (context === "init") {
// Attempt to enable speech synthesis directly for browsers that don't require a click
attemptEnableSpeech();
// For initial setup, require a user click to enable speech synthesis
// Scoping to a particular handler to avoid conflicts with other click events
$(document).on("click", handleInitialClick);
Expand Down