Created
June 5, 2013 12:43
-
-
Save kongaraju/5713587 to your computer and use it in GitHub Desktop.
demo for MOE
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Adding Stream to Audio</title> | |
<!-- Load the polyfill to switch-hit between Chrome and Firefox --> | |
<script src="adapter.js"></script> | |
<style> | |
button { | |
font: 18px sans-serif; | |
padding: 8px; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>Local-Audio</h2> | |
<audio id="audio1" controls="controls" ></audio> | |
<button id="btn1" onclick="addStream()"> | |
Add Stream | |
</button> | |
<script> | |
var btn1 = document.getElementById("btn1"); | |
var audio = document.getElementById("audio1"); | |
function addStream() { | |
getUserMedia({audio : true}, gotStream, function() {}); | |
} | |
function gotStream(stream) { | |
audio.src = window.URL.createObjectURL(stream); | |
audio.play(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment