Re: Event handlers in RTCPeerConnection

On 9/26/2012 3:56 PM, Martin Thomson wrote:
> None of the event handlers for RTCPeerConnection have specific types
> associated with the event.
>
> This might be OK for the "stuff just happened events":
>               attribute EventHandler          onnegotationneeded;
>               attribute EventHandler          onopen;
>
> Each of the following produces an event that includes additional attributes:
>               attribute EventHandler          onicecandidate;
>   - candidate : RTCIceCandidate
>               attribute EventHandler          onstatechange;
>   - state : RTCPeerState
>               attribute EventHandler          onaddstream;
>   - stream : MediaStream
>               attribute EventHandler          onremovestream;
>   - stream : MediaStream ?
>               attribute EventHandler          ongatheringchange;
>   - state : RTCGatheringState
>               attribute EventHandler          onicechange;
>   - state : RTCIceState
>               attribute EventHandler          onidentityresult;
>   - assertion : RTCIdentityAssertion
>   - verified : boolean

   

attribute EventHandler ondatachannel;
   - channel: DataChannel

onconnection, onclosedconnection: no params (and poorly named)

In DataChannel objects:
onopen, onclose: no params
onerror: not defined yet - should try to mirror WebSockets
onmessage: Object (DOMString, Blob or ArrayBuffer) - same as WebSockets


>
> Rather than using the generic EventHandler for each of these events, a
> specific, typed callback function for each these would make
> documentation easier.  That callback would take a subclass of Event
> that included the extra attributes.
>
> Obviously, for some of these it could be just a matter of following
> through e.target.iceState or something like that, but others contain
> vital information.  It would be nice if this could be more clearly
> documented.
>
> --Martin
>


-- 
Randell Jesup
randell-ietf@jesup.org

Received on Wednesday, 26 September 2012 20:43:05 UTC