Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'yzen/demo' into demo

* yzen/demo:
  FLUID-4947: added some fixes to text split and error handling.
  • Loading branch information...
commit 3df820c120139f218e0f5f60cc22b4ab6d21caec 2 parents 2b96d0f + f8c1f4a
@michelled authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/webapp/integration-demos/uiOptions/js/SelfVoicingEnactor.js
View
14 src/webapp/integration-demos/uiOptions/js/SelfVoicingEnactor.js
@@ -69,7 +69,7 @@ var fluid_1_5 = fluid_1_5 || {};
queue: []
},
strings: {
- loaded: "Text to Speech Enabled"
+ loaded: "text to speech enabled"
},
styles: {
current: "fl-selfVoicing-current"
@@ -97,12 +97,18 @@ var fluid_1_5 = fluid_1_5 || {};
$("body").remove(that.options.audioSelector);
$("body").append(that.audio);
var audioElement = that.audio[0];
- audioElement.addEventListener("loadedmetadata", function () {
+ audioElement.addEventListener("canplaythrough", function () {
if (!that.model.value) {
return;
}
audioElement.play();
- setTimeout(that.events.afterAnnounce.fire, audioElement.duration * 1000);
+ setTimeout(that.events.afterAnnounce.fire, audioElement.duration * 1000 + 500);
+ });
+ audioElement.addEventListener("error", function () {
+ if (!that.model.value) {
+ return;
+ }
+ setTimeout(that.events.afterAnnounce.fire, 1500);
});
};
@@ -134,7 +140,7 @@ var fluid_1_5 = fluid_1_5 || {};
return;
}
var currentText = text.substr(0, 100);
- var sIndex = currentText.lastIndexOf("\s");
+ var sIndex = currentText.lastIndexOf(" ");
queue.push(currentText.substring(0, sIndex));
buildSpeechQueueImpl(queue, text.substring(sIndex + 1));
};
Please sign in to comment.
Something went wrong with that request. Please try again.