W3C home > Mailing lists > Public > public-webrtc@w3.org > December 2011

Remove numeric constants from WebRTC

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 16 Dec 2011 14:44:28 -0800
Message-ID: <CAAWBYDAOfhyAYTR84FKDgOrrmL1Kw9sY0czM2M_w=mOZSpy+uA@mail.gmail.com>
To: public-webrtc@w3.org, hta@google.com
WebRTC currently defines numeric constants on a few of its interfaces
(specifically, MediaStream and PeerConnection).  These are verboten in new
JS APIs, as now noted in the WebIDL spec <
http://dev.w3.org/2006/webapi/WebIDL/#idl-constants>.  Instead, the
appropriate properties should simply contain strings.

The MediaStream interface should be changed to:

[Constructor (MediaStreamTrackList? audioTracks, MediaStreamTrackList?
videoTracks)]
interface MediaStream {
    readonly attribute DOMString            label;
    readonly attribute MediaStreamTrackList audioTracks;
    readonly attribute MediaStreamTrackList videoTracks;
    MediaStreamRecorder record ();
-   const unsigned short LIVE = 1;
-   const unsigned short ENDED = 2;
-   readonly attribute unsigned short       readyState;
+   readonly attribute DOMString            readyState;
             attribute Function?            onended;
};

where readyState can be the values "live" or "ended".

The PeerConnection interface should be changed to:

[Constructor (DOMString configuration, SignalingCallback signalingCallback)]
interface PeerConnection {
    void processSignalingMessage (DOMString message);
-   const unsigned short NEW = 0;
-   const unsigned short NEGOTIATING = 1;
-   const unsigned short ACTIVE = 2;
-   const unsigned short CLOSING = 4;
-   const unsigned short CLOSED = 3;
-   readonly attribute unsigned short readyState;
+   readonly attribute DOMString readyState;
-   const unsigned short ICE_GATHERING = 0x100;
-   const unsigned short ICE_WAITING = 0x200;
-   const unsigned short ICE_CHECKING = 0x300;
-   const unsigned short ICE_CONNECTED = 0x400;
-   const unsigned short ICE_COMPLETED = 0x500;
-   const unsigned short ICE_FAILED = 0x600;
-   const unsigned short ICE_CLOSED = 0x700;
-   readonly attribute unsigned short iceState;
+   readonly attribute DOMString iceState;
-   const unsigned short SDP_IDLE = 0x1000;
-   const unsigned short SDP_WAITING = 0x2000;
-   const unsigned short SDP_GLARE = 0x3000;
-   readonly attribute unsigned short sdpState;
+   readonly attribute DOMString sdpState;
    void addStream (MediaStream stream, MediaStreamHints hints);
    void removeStream (MediaStream stream);
    readonly attribute MediaStream[]  localStreams;
    readonly attribute MediaStream[]  remoteStreams;
    void close ();
             attribute Function?      onconnecting;
             attribute Function?      onopen;
             attribute Function?      onstatechange;
             attribute Function?      onaddstream;
             attribute Function?      onremovestream;
};

where readyState can be the value "new", "negotiating", "active",
"closing", or "closed", iceState can be the values "gathering", "waiting",
"checking", "connected", "completed", "failed", or "closed", and sdpState
can be the values "idle", "waiting", or "glare".

~TJ
Received on Friday, 16 December 2011 22:45:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:26 UTC