W3C home > Mailing lists > Public > public-webrtc@w3.org > July 2012

Making RTCSessionDescription and RTCIceCandidate much more flexible

From: ᛏᚮᛘᛘᚤ <tommyw@google.com>
Date: Tue, 31 Jul 2012 11:42:00 +0200
Message-ID: <CALLKCfNqwryojh5GJLMxPZVs-miK_TmrGwuaYSGYARN8rPuYVg@mail.gmail.com>
To: public-webrtc@w3.org
Hello list members,

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.


Regards,
Tommy

-- 
Tommy Widenflycht, Senior Software Engineer
Google Sweden AB, Kungsbron 2, SE-11122 Stockholm, Sweden
Org. nr. 556656-6880
And yes, I have to include the above in every outgoing email according to
EU law.
Received on Tuesday, 31 July 2012 09:42:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:17:30 UTC