Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid WebRTC usernameFragment example #38652

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

Josh-Cena
Copy link
Member

Fix #28171. I have no idea if this code is supposed to work, but at least it's sound type-wise.

@Josh-Cena Josh-Cena requested a review from a team as a code owner March 15, 2025 02:03
@Josh-Cena Josh-Cena requested review from sideshowbarker and removed request for a team March 15, 2025 02:03
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Mar 15, 2025
Copy link
Contributor


for (const receiver of receivers) {
let parameters = receiver.transport.getParameters();
const parameters = receiver.transport.iceTransport.getRemoteParameters();
Copy link
Collaborator

@hamishwillee hamishwillee Mar 16, 2025

Choose a reason for hiding this comment

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

The getParameters is present on the returned receiver, not on the transport. I think the correct fix is this:

Suggested change
const parameters = receiver.transport.iceTransport.getRemoteParameters();
const parameters = receiver.getParameters();

Note, I don't really understand all this deeply either, but my understanding is that the candidate is the proposal from the remote end. We're looking for candidates that match the one we're already using so that we have the same session - others are not relevant to this connection. Upshot, this candidate is something we store on the receiver, not something back from the other end. I could be horribly wrong though. Really just highlighting this for @sideshowbarker who probably actually understands all this.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what one would think, but this returns an RTCRtlsParameters which doesn't have the usernameFragment member. The code here gets an RTCICEParameters which seems to be the only other parameter dictionary that has a usernameFragment member.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point. It looks like you might also get it from receiver.transport.iceTransport.getLocalParameters() but my understanding is that the values should be the same on both ends as it is "for the session". So this makes sense.

I'm going to approve because, as you say, this looks like the only place it can come from.

@sideshowbarker sideshowbarker merged commit cb736d8 into mdn:main Mar 17, 2025
7 checks passed
@Josh-Cena Josh-Cena deleted the fix-rtc-ex branch March 17, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

usernameFragment Examples section contains method that does not exist
3 participants