meSpeak.js (( • ))

Flash Fallback (for IE 10)

A fallback to play meSpeak's wav-files via Flash.
Since typed arrays are still a requirement, the only use-case is MS Internet Explorer 10.
Please note that, since we may not send binary data to a swf-object, the data has to be copied internally to a binary object, which may take some time and memory.
Because of this, the status of this solution is at best "experimental" and not for everyday use.

The fallback "meSpeakFallback.swf" uses the AS3WavSound library (v0.9) for wav-playback inside the SWF. (Ironically Flash doesn't support native wav-playback either.)
The swf-file is compiled for network use, meaning it will work only, if loaded over a network (web-server).

For testing, the fallback is installed for all browsers on this page:

See page source for API & details.

Download: msie_flashFallback.zip
(Installation: Put the unzipped directory inside your mespeak-directory.)


A Note on Usage:
While the fallback-script strips down the coded needed to inject a swf-object to a minimum, best practice would be to include the script only, if applicable (i.e.: for MS IE 10 only), using MS-specific conditional comments:

<!--[if IE 10]> <script type="text/javascript" src="flashFallback.js"></script> <![endif]-->

If doing so, you would have to check for the existence of meSpeakFlashFallback first, before calling it:

if (window.meSpeakFlashFallback) callbackInstalled = meSpeakFlashFallback.install(); // later, see page source for API details and usage if (callbackInstalled) meSpeakFlashFallback.speak('Hello world.');

This way, page- and memory-loads are reduced to a minimum for all browsers.

Please note that there is a delay between calling install() and the fallback actually being available, since the swf-file has to load and initialize first.

 

Norbert Landsteiner, mass:werk – media environments, www.masswerk.at
Vienna, July 2013