function testFunc(done_cb) { var gotEndEvent = false;
// A long utterance that we will interrupt. var utterance = new SpeechSynthesisUtterance("Donec ac nunc feugiat, posuere " + "mauris id, pharetra velit. Donec fermentum orci nunc, sit amet maximus" + "dui tincidunt ut. Sed ultricies ac nisi a laoreet. Proin interdum," + "libero maximus hendrerit posuere, lorem risus egestas nisl, a" + "ultricies massa justo eu nisi. Duis mattis nibh a ligula tincidunt" + "tincidunt non eu erat. Sed bibendum varius vulputate. Cras leo magna," + "ornare ac posuere vel, luctus id metus. Mauris nec quam ac augue" + "consectetur bibendum. Integer a commodo tortor. Duis semper dolor eu" + "facilisis facilisis. Etiam venenatis turpis est, quis tincidunt velit" + "suscipit a. Cras semper orci in sapien rhoncus bibendum. Suspendisse" + "eu ex lobortis, finibus enim in, condimentum quam. Maecenas eget dui" + "ipsum. Aliquam tortor leo, interdum eget congue ut, tempor id elit.");
utterance.addEventListener('start', function(e) {
ok(true, 'start utterance 1');
speechSynthesis.cancel();
info('cancel!');
speechSynthesis.speak(utterance2);
info('speak??');
});
var utterance2 = new SpeechSynthesisUtterance("Proin ornare neque vitae " + "risus mattis rutrum. Suspendisse a velit ut est convallis aliquet." + "Nullam ante elit, malesuada vel luctus rutrum, ultricies nec libero." + "Praesent eu iaculis orci. Sed nisl diam, sodales ac purus et," + "volutpat interdum tortor. Nullam aliquam porta elit et maximus. Cras" + "risus lectus, elementum vel sodales vel, ultricies eget lectus." + "Curabitur velit lacus, mollis vel finibus et, molestie sit amet" + "sapien. Proin vitae dolor ac augue posuere efficitur ac scelerisque" + "diam. Nulla sed odio elit.");
utterance2.addEventListener('start', function() {
info('start');
speechSynthesis.cancel();
speechSynthesis.speak(utterance3);
});
utterance2.addEventListener('end', function(e) {
gotEndEvent = true;
});
var utterance3 = new SpeechSynthesisUtterance("Hello, world 3!");
utterance3.addEventListener('start', function() {
ok(gotEndEvent, "didn't get start event for this utterance");
});
utterance3.addEventListener('end', done_cb);
// Speak/cancel while paused (Bug 1187105)
speechSynthesis.pause();
speechSynthesis.speak(new SpeechSynthesisUtterance("hello."));
ok(speechSynthesis.pending, "paused speechSynthesis has an utterance queued.");
speechSynthesis.cancel();
ok(!speechSynthesis.pending, "paused speechSynthesis has no utterance queued.");
speechSynthesis.resume();
speechSynthesis.speak(utterance);
ok(!speechSynthesis.speaking, "speechSynthesis is not speaking yet.");
ok(speechSynthesis.pending, "speechSynthesis has an utterance queued.");
}
// Run test with no global queue, and then run it with a global queue.
testFunc(function() {
SpecialPowers.pushPrefEnv(
{ set: [['media.webspeech.synth.force_global_queue', true]] }, function() {
testFunc(SimpleTest.finish)
});
});
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.