Provides WebRTC getUserMedia() fallback via Flash plugin for browsers that do not support getUserMedia() natively.
flashGetUserMedia.init({swfPath: 'flashGetUserMedia.swf', force: false});
navigator.getUserMedia({audio: true, video: false}, successHandler, failureHandler);
swfPath
path to flashGetUserMedia.swf fileforce
force usage of flashGetUserMedia even if native getUserMedia is supported by the browser <!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="https://github.com/maciejzasada/flashGetUserMedia/raw/master/vendor/recorder.js"></script>
<script type="text/javascript" src="https://github.com/maciejzasada/flashGetUserMedia/raw/master/flashGetUserMedia.js"></script>
</head>
<body>
<script>
var audioContext, mediaStreamSource, recorder;
function onGetMediaSuccess(source) {
mediaStreamSource = audioContext.createMediaStreamSource(source);
setTimeout(function () {
record();
}, 1);
}
function onGetMediaFail() {
console.log('media fail handler');
}
function record() {
recorder = new Recorder(mediaStreamSource);
recorder.record();
}
function stopAndPlay() {
recorder.stop();
recorder.exportWAV(function(s) {
var audio = document.createElement( 'audio' );
audio.src = window.URL.createObjectURL(s);
audio.id = 'record';
document.body.appendChild(audio);
audio.play();
});
}
flashGetUserMedia.init({swfPath: 'flashGetUserMedia.swf', force: true});
audioContext = new AudioContext();
navigator.getUserMedia({audio: true, video: false}, onGetMediaSuccess, onGetMediaFail);
</script>
</body>
</html>
v. 0.1 (28/06/2013)