Open Bug 1664223 Opened 4 years ago Updated 3 years ago

When using an AudioContext across iframes, get confusing "Connecting AudioNodes from AudioContexts with different sample-rate is currently not supported." error

Categories

(Core :: Audio/Video: MediaStreamGraph, defect, P3)

80 Branch
defect

Tracking

()

Webcompat Priority P3

People

(Reporter: sidney, Unassigned)

References

(Depends on 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file iframe_loopback.html (deleted) —

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:80.0) Gecko/20100101 Firefox/80.0

Steps to reproduce:

  1. Open the attached example.

Actual results:

The following exception is thrown:

Uncaught DOMException: AudioContext.createMediaStreamSource: Connecting AudioNodes from AudioContexts with different sample-rate is currently not supported.

Expected results:

No exception, and a tone should be audible (but may not be, in this example).

For a little bit more context: I ran into this issue while working on a project (https://github.com/s4y/space) where I shared a single audio context among multiple components running in different, same-origin iframes. The design lets the different frames be reloaded (or new frames added and removed) independently, which has worked out great, except for turning up a bug :-).

The actual problem doesn't seem to involve sample rates, so the error message is super confusing.

I think to work around this I'll need to make a separate AudioContext per iframe.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Web Audio
Product: Firefox → Core

Thank you for the quality bug report.

We could probably make this work by keying the MediaTrackGraph instances on the top WindowContext instead of the window. That would require a rethink of code that assumes one graph per window.

An alternative would be to use the inter-graph communication being developed for bug 1267161.

Improving the error message in the meantime could also be helpful.

Severity: -- → S3
Depends on: multimsg
Priority: -- → P3
Regressed by: 1330360
Has Regression Range: --- → yes
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: Web Audio → Audio/Video: MediaStreamGraph
Webcompat Priority: --- → P3
Attached file iframe_audiocontext_getUserMedia.html (deleted) —

Facing this issue as well.
We want to use AudioContext from the same-origin iframe in the host page to do audio analysis of the streams from this host page. However, AudioContext fails to create AudioNodes from capture streams.

Attaching simplified example of the previous code snippet and including getUserMedia() call. The code runs in Chrome but fails in Firefox with the following error:

Uncaught DOMException: AudioContext.createMediaStreamSource: Connecting AudioNodes from AudioContexts with different sample-rate is currently not supported.

Is it possible to prioritise this issue?

any updates on that?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: