Skip to content

Instantly share code, notes, and snippets.

@kongaraju
Created June 5, 2013 12:43
Show Gist options
  • Save kongaraju/5713587 to your computer and use it in GitHub Desktop.
Save kongaraju/5713587 to your computer and use it in GitHub Desktop.
demo for MOE
<!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