WebAudio panning not working with WebRTC

293 Views Asked by At

I'm trying to make sound panning work with audio got through WebRTC, but with the code below it's not outputting any sound at all. But when I do the same thing with my local audio MediaStream it works.

What could be the problem?

var AudioContext = window.AudioContext || window.webkitAudioContext
audioCtx = new AudioContext()
audioCtx.listener.setOrientation(0,0,-1,0,1,0)

var panner = audioCtx.createPanner()
panner.setOrientation(1,0,0)
panner.refDistance = 20
panner.coneInnerAngle = 360
panner.coneOuterAngle = 0
panner.panningModel = 'equalpower'

var source = audioCtx.createMediaStreamSource(peer.stream)
source.connect(panner)
panner.connect(audioCtx.destination)
1

There are 1 best solutions below

1
On

What browser are you using? There are browser bugs that prevent it from working in some versions. Try a Firefox Nightly build (https://nightly.mozilla.org/), we've fixed the WebAudio/WebRTC integration.