views:

283

answers:

3

Hi, is it possible to generate/send video/audio using javascript ??

for example, see jspdf - http://jspdf.googlecode.com/svn/trunk/examples/basic.htm generate client side generated pdf file using base64 encoded datauri and embed the datauri !

Can similar approach be applied for generation of Ogg files ?

This can be useful for text to speech in browser.

+1  A: 

I believe that wave/PCM is supported as an audio format by all browsers that support the media elements, so it should be relatively trivial to generate a data url for a pcm file.

Video is more difficult -- there isn't a standard codec for video, and possibly more importantly i doubt any js engine is fast enough yet to generate encoded video sufficiently quickly (given that native implementations have only relatively recently gotten to > realtime performance)

olliej
This depends on the dimensions, of course. Maybe it would be possible to use canvas to generate **small** videos (resolution-wise). However, we have that sluggish thing some call a *"web browser"*. Macro$hit Idiot Exploiter is not going away soon.
Camilo Martin
+1  A: 

You can embed video and audio data in data URIs

themaninblue has made a javascript drum machine

have a look at the source code as an example

Charles Ma
+1  A: 

Slightly offtopic, but if what you need is text to speech, you could split the text into chunks of up to 100 characters and use Google Translate TTS.

anon