Open Bug 1350777 Opened 7 years ago Updated 2 years ago

AudioContext.createMediaStreamSource with a remote PeerConnection Stream gives a cross origin warning message

Categories

(Core :: Web Audio, enhancement, P3)

Unspecified
All
enhancement

Tracking

()

Tracking Status
firefox55 --- affected

People

(Reporter: adam, Unassigned)

Details

When calling audioContext.createMediaStreamSource with a MediaStream from a remote PeerConnection you get the following warning message:

"the mediastream passed to createMediaStreamSource has a cross-origin resource, the node will output silence"

However the audio still outputs and you are able to create an analyser and analyse the audio data. It seems that this error message should not be displayed. It doesn't seem to have any effect but it's confusing and our customers are complaining about it.

Steps to repro:

1. Open https://meet.tokbox.com/testAudio in 2 tabs
2. Allow access to camera/microphone and wait for the PeerConnection to be established.

Result: Observe the warning in the console "the mediastream passed to createMediaStreamSource has a cross-origin resource, the node will output silence"

Expected Result: No warning message.


We are using the media stream source to analyse the audio data and display the output audio level to the user when they turn off their camera. If you turn of your camera in the meet.tokbox.com app by clicking on the camera button then you will see that the audio output is being displayed as the green pulsing circle in the top right hand corner.
Component: Device Permissions → Web Audio
Product: Firefox → Core
Rank: 25
Priority: -- → P2
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3
From the top of my head,

You're getting this error because the peer connection where the stream is originating from hasn't established the DTLS connection when you hook the stream up with WebAudio. Only when DTLS is established we know that isolation was not requested and can lift the cross-origin constraint.

The spec mandates that we expose the track and stream before the connection is set up, immediately after setRemoteDescription().

To work around this you need to hook the stream up to WebAudio *after* DTLS is established. I'm not sure whether the peer connection has an event for this yet, but waiting for media to flow works. The only way to do this to date, without warnings, is a media element. If you're anyway using a media element to render this stream, it's a simple operation. The "loadeddata" event should do the trick.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.