[whatwg] RTC API Proposal

On Mon, Jul 11, 2011 at 7:01 PM, Anant Narayanan <anant at mozilla.com> wrote:
> Hi,
>
> Mozilla and Cisco have been working on an API for real time communication,
> which we sent out today to the W3C WebRTC working group
> (http://lists.w3.org/Archives/Public/public-webrtc/2011Jul/0010.html). It
> builds on both the WHATWG RTC proposal by Ian Hickson as well as the
> MediaStream Processing API by Robert O'Callahan.
>
> There are few differences though, and they are presented at:
> http://lists.w3.org/Archives/Public/public-webrtc/2011Jul/0012.html
>
> The proposal itself lives at:
> https://github.com/mozilla/rainbow/wiki/RTC_API_Proposal
>
> There is some discussion going on about the proposal on the W3C list but we
> would love to hear your feedback.

Some minor nits:

> constructor PeerListener(DOMString config, optional DOMString negotiationServerURN)
> interface PeerListener {
>     void listen();
>     attribute Function onIncoming;
> };
> Window implements PeerListener;

The WebIDL syntax here is a bit wrong, I suspect you're looking for
something like:

[Constructor(in DOMString config, in optional DOMString negotiationServerURN)]
interface PeerListener {
    void listen();
    attribute Function onIncoming;
};
Window implements PeerListener;

You probably don't mean the last "implements" line. That line
currently says that Windows *are* PerrListeners. I.e. that you can do
window.listen() and window.onIncoming = function() { ... }, which is
likely not what you want. Simply remove the line as declaring the
constructor should be enough.

To keep consistent with all other onfoo listeners, you should use all
lowercase name: onincoming.

It seems like you are saying that the function assigned to onincoming
receives a Connection object as its first argument. However generally
onfoo attributes are EventListeners and so always receives an Event
object as its first and only argument. If your intent is to be
consistent with other onfoo attributes you should instead create a
PeerListenerEvent object which inherits Event and makes the Connection
available as a property on it. You should also make PeerListener an
EventTarget.

In the example where you create a PeerListener, it appears that you're
only passing the second negotiationServerURN argument
("stun:foobar.net:3476"). But the constructor above says that the
first argument is a "config" string, and that it's not optional. I'm
in particular curious what the syntax for the config string is, and if
it would be better done as a Dictionary. Would love to see some
examples.

In the example you also create a PeerConnection object using |new
PeerConnection("stun:foobar.net:3476", sendToB);|. However the
interface declaration for PeerListener does not include a constructor.
I'm trying to figure out how the sendToB and gotFromB functions work
in the "Simple Video Call" example, but it the lack of description for
the PeerListener constructor is preventing that. It also seems like
the gotFromB is unused which I assume is a bug in the example.

/ Jonas

Received on Monday, 11 July 2011 20:14:09 UTC