Nawaf Alsulami
Nawaf Alsulami

Reputation: 719

"SpeechSynthesisUtterance is not defined" in Chrome and Firefox

The following Dart code does not work on Chrome or Firefox.

import 'dart:html';

void main() {
  SpeechSynthesisUtterance speechSynthesisUtterance = new SpeechSynthesisUtterance();
  speechSynthesisUtterance.lang = 'en-US';
  speechSynthesisUtterance.rate = 1;

  DivElement div = querySelector("#text");
  querySelector('#read').onClick.listen((e) {
    speechSynthesisUtterance.text = div.text;
    window.speechSynthesis.speak(speechSynthesisUtterance);
  });

}

The browser's console displays this error:

Uncaught ReferenceError: SpeechSynthesisUtterance is not defined 

This was tested on: Chromium Version (31.0.1650.63) & Firefox (26.0) on Ubuntu 13.10 x64

Any idea what is going wrong?

Upvotes: 0

Views: 3919

Answers (1)

Pixel Elephant
Pixel Elephant

Reputation: 21383

This is not a Dart-specific problem. If you try the equivalent JavaScript it will also not work in those browsers since this API does not seem to be fully supported yet. It does work in Dartium though.

Upvotes: 2

Related Questions