CSPRNG in JavaScript using Audio and Video I ported GnuPG to Javascript using Emscripten (not released yet).
Now I need a good replacement for /dev/random//dev/urandom.
New browsers support window.crypto.getRandomValues() but for older browsers I need something else.
I was thinking about recording some audio using HTML5 and calculating the sha 512-bit digest.
Then splitting this digest into two halfs and using them for AES 256-bit encryption (256-bit IV and 256-bit key) of a photo taken also with HTML5.

Is it safe to use this encrypted image as a replacement of /dev/(u)random?
Which mode should I use for AES encryption?
window.crypto.getRandomValues() is the best you can do.  Unfortunately, at the time of writing, too many browsers don't support window.crypto.getRandomValues(): see Compatibility of window.crypto.getRandomValues().

The alternative is to use fallback methods.  However, those fallback methods are kind've hacky, of dubious security, slow, and have other limitations.  For more on the available fallback methods, see Generate cryptographically strong pseudorandom numbers in Javascript?.

Therefore, life kinda sucks.  Basically, the best you can do is test for the existence of window.crypto.getRandomValues() using feature testing.  If it exists, great! use it.  If it doesn't exist, fall back to one of the fallback methods -- in that case, life is unhappy, but what can you do, there's no better option.