[Bug 18486] New: Let RTCSessionDescription take a Dictionary parameter

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18486

           Summary: Let RTCSessionDescription take a Dictionary parameter
           Product: WebRTC Working Group
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebRTC API
        AssignedTo: public-webrtc@w3.org
        ReportedBy: harald@alvestrand.no
                CC: public-webrtc@w3.org


>From Tommy Widenflycht, July 31 (see mailing list for discussion):

Today I would like to propose a small change to RTCSessionDescription and
RTCIceCandidate which would make the much more flexible:

[Constructor(optional Dictionary description)]
interface RTCSessionDescription {
             attribute RTCSdpType type;
             attribute DOMString  sdp;
};

In short the single constructor takes an Dictionary which is expected to mimic
its members, and the stringifier method is removed.


This has the advantages of being extremely powerful:

sd = new RTCSessionDescription();
sd.sdp = ...;
sd.type = ...;

sd = new RTCSessionDescription({sdp:"..."});
sd.type = ...;

sd = new RTCSessionDescription({type:"answer", sdp:"..."});

sd = new RTCSessionDescription(JSON.parse(some_json_string));

sd2 = new RTCSessionDescription(sd);

and in the other direction

jsonified_sd = JSON.stringify(sd);


There's some precedence in using a constructor like this in some of the base
Event classes.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.

Received on Saturday, 4 August 2012 00:22:05 UTC