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

Broken link to RTCSessionDescriptionInit, RTCLocalSessionDescriptionInit #33962

Closed
bc-lee opened this issue Jun 6, 2024 · 0 comments · Fixed by #33963
Closed

Broken link to RTCSessionDescriptionInit, RTCLocalSessionDescriptionInit #33962

bc-lee opened this issue Jun 6, 2024 · 0 comments · Fixed by #33963
Labels
area: WebRTC Needs help from someone with WebRTC domain knowledge Content:WebAPI Web API docs

Comments

@bc-lee
Copy link
Contributor

bc-lee commented Jun 6, 2024

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

The page for RTCPeerConnection.createAnswer has a broken link to RTCSessionDescriptionInit because there is no separate page for it

Actually there is a bigger issue here. MDN needs to clarify the relationship between RTCSessionDescription, RTCSessionDescriptionInit, and RTCLocalSessionDescriptionInit.

What did you expect to see?

A page for RTCSessionDescriptionInit, also a separate page for RTCLocalSessionDescriptionInit would be nice. Also clarify the relationship between RTCSessionDescription, RTCSessionDescriptionInit, and RTCLocalSessionDescriptionInit.

Do you have any supporting links, references, or citations?

https://w3c.github.io/webrtc-pc

Do you have anything more you want to share?

Here is my understanding of this issue (since this is long, I will use a collapsible section):

Details

Relevant WebIDL definitions for RTCSessionDescription, RTCSessionDescriptionInit, and RTCLocalSessionDescriptionInit (from https://w3c.github.io/webrtc-pc):

[Exposed=Window]
interface RTCSessionDescription {
  constructor(RTCSessionDescriptionInit descriptionInitDict);
  readonly attribute RTCSdpType type;
  readonly attribute DOMString sdp;
  [Default] RTCSessionDescriptionInit toJSON();
};

dictionary RTCSessionDescriptionInit {
  required RTCSdpType type;
  DOMString sdp = "";
};

dictionary RTCLocalSessionDescriptionInit {
  RTCSdpType type;
  DOMString sdp = "";
};

[Exposed=Window]
interface RTCPeerConnection : EventTarget  {
...
  Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
  Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});

  Promise<undefined> setLocalDescription(optional RTCLocalSessionDescriptionInit description = {});
  readonly attribute RTCSessionDescription? localDescription;
  readonly attribute RTCSessionDescription? currentLocalDescription;
  readonly attribute RTCSessionDescription? pendingLocalDescription;
  Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description);
  readonly attribute RTCSessionDescription? remoteDescription;
  readonly attribute RTCSessionDescription? currentRemoteDescription;
  readonly attribute RTCSessionDescription? pendingRemoteDescription;
...
}

Understanding RTCSessionDescription:

  • Core Interface: RTCSessionDescription is the fundamental interface representing a session description in WebRTC signaling.
  • Properties: It has two essential properties:
    • type: Specifies the SDP type (e.g., "offer", "answer", "pranswer", or "rollback").
    • sdp: Contains the actual SDP string, which is meaningless for the "rollback" type.

RTCSessionDescriptionInit and RTCLocalSessionDescriptionInit

These names closely resemble RTCSessionDescription, but they serve a different purpose. Here's a breakdown:

  • Dictionaries, Not Classes: Unlike RTCSessionDescription (an interface), these are dictionaries. You don't need a specific instance to create them; any conforming object will suffice.
  • Arguments for Setting Session Descriptions: They are primarily used as arguments for the RTCPeerConnection.setLocalDescription() and RTCPeerConnection.setRemoteDescription() methods, allowing you to set session descriptions without creating a full-fledged RTCSessionDescription object.
  • Return Values for Creating SDP: RTCSessionDescriptionInit is also the return type for RTCPeerConnection.createOffer() and RTCPeerConnection.createAnswer(), which generate SDP strings. These generated SDPs are typically used for either setting a local description or sending them to a remote peer.

Why Separate Interfaces?

The separation between RTCSessionDescriptionInit and RTCLocalSessionDescriptionInit might seem unnecessary and confusing at first. Here's the reasoning:

  • Evolution of WebRTC: WebRTC has been around for over a decade and is constantly evolving. Initially, RTCPeerConnection.setLocalDescription() always required both an SDP string and a type.
  • Parameterless setLocalDescription: A few years ago, this method was updated to allow omitting any arguments. This feature, sometimes called "parameterless setLocalDescription," is part of the "Perfect Negotiation" functionality. It enables users to skip the separate calls to RTCPeerConnection.createOffer() and RTCPeerConnection.setLocalDescription(). They can simply use the parameterless version of setLocalDescription().
  • RTCLocalSessionDescriptionInit for Flexibility: To accommodate this change, RTCLocalSessionDescriptionInit was introduced. Unlike RTCSessionDescriptionInit, it doesn't even require a type property. In WebIDL, if you call RTCPeerConnection.setLocalDescription() without any arguments, it's equivalent to calling RTCPeerConnection.setLocalDescription({}). This can be seen as a way to enhance WebIDL's flexibility.

In Summary:

  • RTCSessionDescription: Core interface representing a session description.
  • RTCSessionDescriptionInit: Dictionary used to create session descriptions and as a return type for createOffer() and createAnswer().
  • RTCLocalSessionDescriptionInit: Dictionary specifically used for setting local session descriptions, allowing omission of the type property.

MDN metadata

Page report details
@bc-lee bc-lee added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 6, 2024
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jun 6, 2024
bc-lee added a commit to bc-lee/mdn-content that referenced this issue Jun 6, 2024
…lSessionDescriptionInit

Add missing documentation for RTCSessionDescriptionInit,
RTCLocalSessionDescriptionInit interfaces. Also correct several links
referencing those interfaces. Also add a clear explanation of the
relationship between RTCSessionDescription, RTCSessionDescriptionInit,
and RTCLocalSessionDescriptionInit interfaces.

Fixes mdn#33962
@Josh-Cena Josh-Cena added area: WebRTC Needs help from someone with WebRTC domain knowledge and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 7, 2024
@Josh-Cena Josh-Cena changed the title Missing page for RTCSessionDescriptionInit in RTCPeerConnection.createAnswer documentation Broken link to RTCSessionDescriptionInit, RTCLocalSessionDescriptionInit Jun 7, 2024
fiji-flo pushed a commit that referenced this issue Oct 2, 2024
* fix: Add missing documentation for RTCSessionDescriptionInit, RTCLocalSessionDescriptionInit

Add missing documentation for RTCSessionDescriptionInit,
RTCLocalSessionDescriptionInit interfaces. Also correct several links
referencing those interfaces. Also add a clear explanation of the
relationship between RTCSessionDescription, RTCSessionDescriptionInit,
and RTCLocalSessionDescriptionInit interfaces.

Fixes #33962

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Apply Code Review

Combine RTCSessionDescriptionInit and RTCLocalSessionDescriptionInit
descriptions within the RTCSessionDescription page.
Additionally, update any related links.

* Update files/en-us/web/api/rtcsessiondescription/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update files/en-us/web/api/rtcsessiondescription/rtcsessiondescription/index.md

* Update

* Update files/en-us/web/api/rtcpeerconnection/setlocaldescription/index.md

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix

* Fix others

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joshua Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: WebRTC Needs help from someone with WebRTC domain knowledge Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants