Re: Mozilla/Cisco API Proposal - listening

On Fri, 15 Jul 2011, Anant Narayanan wrote:
> I would very much like for explicit connect() and listen() methods even 
> if we do end up implementing nested event loops in Gecko. In my opinion, 
> code just reads cleaner when you say:
> var conn = new PeerConection(...);
> conn.onRemoteStreamAdded = function(stream) {
>   console.log("stream was added");
> };
> conn.connect();
> instead of omitting the connect() and hoping that your 
> onRemoteStreamAdded callback will be called magically.

There's no magic here. The PeerConnection constructor invokes the 
signaling callback and as soon as the ICE agent has a stream negotiated, 
the event notifiying that a stream has been added is fired.

> It also makes clear the distinction between streams that were added 
> before the RTP negotiation happened, and those that were added after and 
> sets expectations accordingly.

No streams can be added from the remote peer before the ICE agent runs, 
since the ICE agent is how the UA learns of the remote streams. Do you 
mean local streams? Those wouldn't fire an event when added, so I don't 
really follow how it would help distinguish anything.

As far as I can tell, adding connect() would just make the API 
error-prone: it adds no functionality, yet makes using the interface more 
complicated (you have to do more calls).

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 16 July 2011 06:31:38 UTC