Skip to content

Add AudioListener features for spatial audio#2628

Merged
ddbeck merged 10 commits intomainfrom
audio-listener
Feb 3, 2026
Merged

Add AudioListener features for spatial audio#2628
ddbeck merged 10 commits intomainfrom
audio-listener

Conversation

@captainbrosset
Copy link
Copy Markdown
Contributor

api.AudioListener.setOrientation and api.AudioListener.setPosition are deprecated but are currently the only way to set an audio listener's orientation and position in Firefox. So there's no use creating a discouraged feature for this. At least not until https://bugzil.la/1283029 gets fixed and BCD gets updated.

For now, why don't we put these keys under Web Audio. Anyway, the whole feature uses a compute_from field which will hide any weirdness from these keys.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Feb 10, 2025
@captainbrosset
Copy link
Copy Markdown
Contributor Author

Whoops, npm run dist isn't happy. I'm not supposed to add deprecated keys to a published feature. So, I guess we should:

  • Either ignore these keys for now.
  • Or add them to a discouraged feature, but I don't think doing this is useful to anyone.
  • Or maybe change the rules to allow adding deprecated keys somehow?

@ddbeck
Copy link
Copy Markdown
Collaborator

ddbeck commented Feb 11, 2025

OK, so now we now have a real-life example of an API that is totally harmless to use, is interoperable, but is nevertheless marked as deprecated without an interoperable alternative. Frustrating! Also, this was a specific kind of discouraged case that @atopal was concerned about.

It does seem like the sort of thing that just ought to be Baseline, at least until Firefox ships the mainstream alternative. I think my inclination here is to make some sort of exception or editorial override, assuming these cases are rare, as they have been so far.

But I'm not sure if they're rare yet. What do you think of marking this PR as a draft until we've dealt with more of the deprecated BCD keys?

@captainbrosset
Copy link
Copy Markdown
Contributor Author

Sounds good to me. Let's leave this one off to the side for now, until we find other similar cases, if any.

@captainbrosset captainbrosset marked this pull request as draft February 11, 2025 12:55
@atopal
Copy link
Copy Markdown
Collaborator

atopal commented Feb 11, 2025

Thanks for calling this out! I'd also like to see if we have more of them.

@captainbrosset
Copy link
Copy Markdown
Contributor Author

Discussed on the WebDX CG call now. From Daniel: There are some cases where we have new discouraged features. But the actual standard, non-discouraged, alternative isn't shipped (or at least not as available as what's discouraged). These things aren't being removed from browsers.
It's probably one of these cases. Spec says not to do this, but the alternative is not really usable.
We could mint a discouraged feature.

@captainbrosset
Copy link
Copy Markdown
Contributor Author

We could mint a discouraged feature.

Revisiting this after a while, I'm on the fence about whether to create a new discouraged feature.

What setOrientation() and setPosition() (which are deprecated) allow you to do is to spatialize sound. The correct way to do this is by using the AudioListener's instance properties like positionX/Y/Z, forwardX/Y/Z, and upX/Y/Z.
These are not implemented in Firefox yet.

We could mint a new feature called something like "Spatial web audio", which would be Limited Availability. In it, we'd use the BCD keys from the parent web-audio feature (which are hidden away from there anyway, because we use compute_from):

  • api.AudioListener.forwardX
  • api.AudioListener.forwardY
  • api.AudioListener.forwardZ
  • api.AudioListener.positionX
  • api.AudioListener.positionY
  • api.AudioListener.positionZ
  • api.AudioListener.upX
  • api.AudioListener.upY
  • api.AudioListener.upZ

And then we'd still need a way to deal with setOrientation() and setPosition(). What would we call a discouraged feature that contains those 2 keys? "Spatial web audio (discouraged)"?

@captainbrosset captainbrosset changed the title Add more keys to Web Audio New AudioListener feature for spatial audio Jan 15, 2026
@captainbrosset captainbrosset marked this pull request as ready for review January 15, 2026 14:58
@captainbrosset
Copy link
Copy Markdown
Contributor Author

I implemented what I said in my previous comment and I'm actually quite happy with how it looks.

@ddbeck what do you think?

Copy link
Copy Markdown
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the way this looks! A few nitpicky suggestions below, but the overall shape of this is nice.

@captainbrosset captainbrosset requested a review from ddbeck January 30, 2026 10:26
@ddbeck ddbeck changed the title New AudioListener feature for spatial audio Add AudioListener feature for spatial audio Feb 3, 2026
@ddbeck ddbeck changed the title Add AudioListener feature for spatial audio Add AudioListener features for spatial audio Feb 3, 2026
@ddbeck ddbeck merged commit 0485013 into main Feb 3, 2026
3 checks passed
@ddbeck ddbeck deleted the audio-listener branch February 3, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature definition Creating or defining new features or groups of features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants