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

Re: Making RTCSessionDescription and RTCIceCandidate much more flexible

From: Adam Bergkvist <adam.bergkvist@ericsson.com>
Date: Mon, 13 Aug 2012 17:29:21 +0200
Message-ID: <50291D51.9060201@ericsson.com>
To: "Tommy Widenflycht (ᛏᚮᛘᛘᚤ)" <tommyw@google.com>
CC: Martin Thomson <martin.thomson@gmail.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
The question is if the default one is sufficient.

/Adam

On 2012-07-31 17:19, Tommy Widenflycht (ᛏᚮᛘᛘᚤ) wrote:
> In that case the stringifier obviously should be in. My misstake.
>
> /Tommy
>
> On Tue, Jul 31, 2012 at 5:14 PM, Martin Thomson
> <martin.thomson@gmail.com <mailto:martin.thomson@gmail.com>> wrote:
>
>     I am told on good authority that JSON.stringify(<some interface>)
>     doesn't do what you expected without a stringifier.
>
>     On 31 July 2012 02:42, Tommy Widenflycht (ᛏᚮᛘᛘᚤ) <tommyw@google.com
>     <mailto:tommyw@google.com>> wrote:
>      > 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.
>
>
>
>
> --
> 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 Monday, 13 August 2012 15:29:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 13 August 2012 15:29:54 GMT