javascript - oscilloscope of speaker input stops rendering after a few seconds -
the following script reads audio user's microphone , renders oscilloscope on html canvas.
the source taken example of mozilla developer network: visualizations web audio api
and here fiddle: http://jsfiddle.net/b7j8pktp/
mozgetusermedia
(note: code has no fork mechanism different browsers: works firefox)
it works fine few seconds , stops rendering.
whereas works totally stable: http://mdn.github.io/voice-change-o-matic/
the problem can reduced following code. microphone activation icon (next the address bar in firefox) disappears after 5 seconds:
navigator.mozgetusermedia({audio: true}, function() {}, function() {} );
this known bug in firefox. take stream getusermedia call , hook window so:
navigator.mozgetusermedia({audio: true}, function(stream) { window.stream = stream; // rest of code }, function err() { // handle error });
hopefully can fixed soon. problem we're failing add reference stream when audiocontext.createmediastreamsource
call, stream not referenced anymore when getusermedia
callback returns, , collected cycle collector when runs, is, couple seconds later.
you can follow along in https://bugzilla.mozilla.org/show_bug.cgi?id=934512.
Comments
Post a Comment