Created
September 1, 2014 03:22
-
-
Save aike/e0c4b9062b42b87de8b1 to your computer and use it in GitHub Desktop.
getUserMedia API mock for audio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This program is licensed under the MIT License. | |
navigator.webkitGetUserMedia = function(opt, ok, ng) { | |
ok(null); | |
}; | |
AudioContext.prototype.createMediaStreamSource = function() { | |
var osc = this.createOscillator(); | |
osc.type = 'sine'; | |
var gain = this.createGain(); | |
gain.gain.value = 0.0; | |
osc.connect(gain); | |
osc.start(0); | |
setInterval(function() { | |
gain.gain.value = 0.5; | |
setTimeout(function() { gain.gain.value = 0.0; }, 800); | |
}, 1000); | |
return gain; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment