Skip to content

Instantly share code, notes, and snippets.

@cozzbie
Last active January 11, 2018 15:44
Show Gist options
  • Save cozzbie/b7287fbae49dcba27c25cb11ddcb47cd to your computer and use it in GitHub Desktop.
Save cozzbie/b7287fbae49dcba27c25cb11ddcb47cd to your computer and use it in GitHub Desktop.
A WebRTC audio channel.
function streamSuccess(stream) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContext();
// Create an AudioNode from the stream
var mediaStreamSource = audioContext.createMediaStreamSource(stream);
// Hear thyself!
mediaStreamSource.connect(audioContext.destination);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment