function loadAudioAndAddToPeerConnection(url, peerconnection) {
if (gContext == null)
- gContext = new webkitAudioContext();
+ gContext = new AudioContext();
var inputSink = gContext.createMediaStreamDestination();
peerconnection.addStream(inputSink.stream);
request.responseType = 'arraybuffer';
request.onload = function() {
- voiceSoundBuffer = gContext.createBuffer(request.response, false);
- callback(voiceSoundBuffer);
+ gContext.decodeAudioData(request.response, function (decodedAudio) {
+ voiceSoundBuffer = decodedAudio;
+ callback(voiceSoundBuffer);
+ });
}
request.send();
}