Search completed in 1.07 seconds.
14 results for "connectionstatechange":
RTCPeerConnection: iceconnectionstatechange event - Web APIs
WebAPIRTCPeerConnectioniceConnectionStatechange event
an iceconnectionstatechange event is sent to an rtcpeerconnection object each time the ice connection state changes during the negotiation process.
... bubbles no cancelable no interface event event handler property oniceconnectionstatechange one common task performed by the iceconnectionstatechange event listener: to trigger ice restart when the state changes to failed.
... examples an event handler for this event can be added using the rtcpeerconnection.oniceconnectionstatechange property or by using addeventlistener() on the rtcpeerconnection.
...And 2 more matches
RTCPeerConnection: connectionstatechange event - Web APIs
WebAPIRTCPeerConnectionconnectionstatechange event
the connectionstatechange event is sent to the ontrack event handler on an rtcpeerconnection object after a new track has been added to an rtcrtpreceiver which is part of the connection.
... bubbles no cancelable no interface event event handler onconnectionstatechange examples for an rtcpeerconnection, pc, this example sets up a handler for connectionstatechange messages to handle changes to the connectivity of the webrtc session.
... pc.onconnectionstatechange = ev => { switch(pc.connectionstate) { case "new": case "checking": setonlinestatus("connecting..."); break; case "connected": setonlinestatus("online"); break; case "disconnected": setonlinestatus("disconnecting..."); break; case "closed": setonlinestatus("offline"); break; case "failed": setonlinestatus("error"); break; default: setonlinestatus("unknown"); break; } } you can also create a handler for connectionstatechange by using addeventlistener(): pc.addeventlistener("connectionstatechange", ev => { switch(pc.connectionstate) { /* ...
... */ } }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'connectionstatechange' in that specification.
RTCPeerConnection.oniceconnectionstatechange - Web APIs
WebAPIRTCPeerConnectiononiceconnectionstatechange
the rtcpeerconnection.oniceconnectionstatechange property is an event handler which specifies a function to be called when the iceconnectionstatechange event is fired on an rtcpeerconnection instance.
... syntax rtcpeerconnection.oniceconnectionstatechange = eventhandler; value this event handler can be set to function which is passed a single input parameter: an event object describing the iceconnectionstatechange event which occurred.
... pc.oniceconnectionstatechange = function(event) { if (pc.iceconnectionstate === "failed" || pc.iceconnectionstate === "disconnected" || pc.iceconnectionstate === "closed") { // handle the failure } }; of course, "disconnected" and "closed" don't necessarily indicate errors; these can be the result of normal ice negotiation, so be sure to handle these properly (if at all).
... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.oniceconnectionstatechange' in that specification.
RTCPeerConnection.onconnectionstatechange - Web APIs
WebAPIRTCPeerConnectiononconnectionstatechange
the rtcpeerconnection.onconnectionstatechange property specifies an eventhandler which is called to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection.
... syntax rtcpeerconnection.onconnectionstatechange = eventhandler; value a function which is called by the browser when the connectionstatechange event occurs on the rtcpeerconnection.
... example pc.onconnectionstatechange = function(event) { switch(pc.connectionstate) { case "connected": // the connection has become fully connected break; case "disconnected": case "failed": // one or more transports has terminated unexpectedly or in an error break; case "closed": // the connection has been closed break; } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onconnectionstatec...
RTCPeerConnection - Web APIs
WebAPIRTCPeerConnection
the event is sent immediately after the call setremotedescription() and doesn't wait for the result of the sdp negotiation.onconnectionstatechangethe rtcpeerconnection.onconnectionstatechange property specifies an eventhandler which is called to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection.
...this happens whenever the local ice agent needs to deliver a message to the other peer through the signaling server.oniceconnectionstatechange the rtcpeerconnection.oniceconnectionstatechange property is an event handler which specifies a function to be called when the iceconnectionstatechange event is fired on an rtcpeerconnection instance.
... connectionstatechange sent to the rtcpeerconnection object when the overall connectivity status of the rtcpeerconnection changes.
...And 3 more matches
Signaling and video calling - Web APIs
WebAPIWebRTC APISignaling and video calling
{ urls: "stun:stun.stunprotocol.org" } ] }); mypeerconnection.onicecandidate = handleicecandidateevent; mypeerconnection.ontrack = handletrackevent; mypeerconnection.onnegotiationneeded = handlenegotiationneededevent; mypeerconnection.onremovetrack = handleremovetrackevent; mypeerconnection.oniceconnectionstatechange = handleiceconnectionstatechangeevent; mypeerconnection.onicegatheringstatechange = handleicegatheringstatechangeevent; mypeerconnection.onsignalingstatechange = handlesignalingstatechangeevent; } when using the rtcpeerconnection() constructor, we will specify an rtcconfiguration-compliant object providing configuration parameters for the connection.
... rtcpeerconnection.oniceconnectionstatechange the iceconnectionstatechange event is sent by the ice layer to let you know about changes to the state of the ice connection.
...e rtcpeerconnection object: function closevideocall() { var remotevideo = document.getelementbyid("received_video"); var localvideo = document.getelementbyid("local_video"); if (mypeerconnection) { mypeerconnection.ontrack = null; mypeerconnection.onremovetrack = null; mypeerconnection.onremovestream = null; mypeerconnection.onicecandidate = null; mypeerconnection.oniceconnectionstatechange = null; mypeerconnection.onsignalingstatechange = null; mypeerconnection.onicegatheringstatechange = null; mypeerconnection.onnegotiationneeded = null; if (remotevideo.srcobject) { remotevideo.srcobject.gettracks().foreach(track => track.stop()); } if (localvideo.srcobject) { localvideo.srcobject.gettracks().foreach(track => track.stop()); } mypeerco...
...And 3 more matches
Index - Web APIs
WebAPIIndex
3434 rtcpeerconnection.onconnectionstatechange api, connection state, event handler, ice, property, rtcpeerconnection, reference, webrtc, onconnectionstatechange the rtcpeerconnection.onconnectionstatechange property specifies an eventhandler which is called to handle the connectionstatechange event when it occurs on an instance of rtcpeerconnection.
... 3438 rtcpeerconnection.oniceconnectionstatechange event handler, experimental, property, rtcpeerconnection, reference, webrtc, oniceconnectionstatechange the rtcpeerconnection.oniceconnectionstatechange property is an event handler which specifies a function to be called when the iceconnectionstatechange event is fired on an rtcpeerconnection instance.
... 3462 rtcpeerconnection: connectionstatechange event the connectionstatechange event is sent to the ontrack event handler on an rtcpeerconnection object after a new track has been added to an rtcrtpreceiver which is part of the connection.
... 3465 rtcpeerconnection: iceconnectionstatechange event api, connection, connectivity, disconnect, ice, media, rtcpeerconnection, reference, webrtc, webrtc api, events, iceconnectionstate, iceconnectionstatechange an iceconnectionstatechange event is sent to an rtcpeerconnection object each time the ice connection state changes during the negotiation process.
Using DTMF with WebRTC - Web APIs
WebAPIWebRTC APIUsing DTMF
function connectanddial() { callerpc = new rtcpeerconnection(); hasaddtrack = (callerpc.addtrack !== undefined); callerpc.onicecandidate = handlecallericeevent; callerpc.onnegotiationneeded = handlecallernegotiationneeded; callerpc.oniceconnectionstatechange = handlecallericeconnectionstatechange; callerpc.onsignalingstatechange = handlecallersignalingstatechangeevent; callerpc.onicegatheringstatechange = handlecallergatheringstatechangeevent; receiverpc = new rtcpeerconnection(); receiverpc.onicecandidate = handlereceivericeevent; if (hasaddtrack) { receiverpc.ontrack = handlereceivertrackevent; } else { receiverpc.onaddstream ...
...to accomplish that, we watch for the caller to receive an iceconnectionstatechange event.
... function handlecallericeconnectionstatechange() { log("caller's connection state changed to " + callerpc.iceconnectionstate); if (callerpc.iceconnectionstate === "connected") { log("sending dtmf: \"" + dialstring + "\""); dtmfsender.insertdtmf(dialstring, 400, 50); } } the iceconnectionstatechange event doesn't actually include within it the new state, so we get the connection process's current state from callerpc's rtcpeerconnection.iceconnectionstate property.
RTCOfferOptions.iceRestart - Web APIs
WebAPIRTCOfferOptionsiceRestart
fundamentally, this renegotiation is triggered by generating and using new values for the ice username fragment ("ufrag")}} example this example shows a handler for the iceconnectionstatechange event.
... pc.oniceconnectionstatechange = function(evt) { if (pc.iceconnectionstate === "failed") { if (pc.restartice) { pc.restartice(); } else { pc.createoffer({ icerestart: true }) .then(pc.setlocaldescription) .then(sendoffertoserver); } } } if the state changes to failed, this handler starts by looking to see if the rtcpeerconnection includes the restartice() method; if it does, we call that to request an ice restart.
RTCPeerConnection.restartIce() - Web APIs
WebAPIRTCPeerConnectionrestartIce
example this example creates a handler for the iceconnectionstatechange event that handles a transition to the failed state by restarting ice in order to try again.
... pc.addeventlistener("iceconnectionstatechange", event => { if (pc.iceconnectionstate === "failed") { /* possibly reconfigure the connection in some way here */ /* then request ice restart */ pc.restartice(); } }); with this code in place, a transition to the failed state during ice negotiation will cause a negotiationneeded event to be fired, in response to which your code should renegotiate as usual.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
WebAPIWebRTC APIPerfect negotiation
the old way in the past, if you encountered an ice error and needed to restart negotiation, you might have done something like this: pc.onnegotiationneeded = async options => { await pc.setlocaldescription(await pc.createoffer(options)); signaler.send({ description: pc.localdescription }); }; pc.oniceconnectionstatechange = () => { if (pc.iceconnectionstate === "failed") { pc.onnegotiationneeded({ icerestart: true }); } }; this has a number of reliability issues and outright bugs (such as failing if the iceconnectionstatechange event fires when the signaling state isn't stable), but there was no way you could actually request an ice restart other than by creating and sending an offer with the icerestart ...
... using restartice() now, you can use restartice() to do this much more cleanly: pc.onnegotiationneeded = async options => { await pc.setlocaldescription(await pc.createoffer(options)); signaler.send({ description: pc.localdescription }); }; pc.oniceconnectionstatechange = () => { if (pc.iceconnectionstate === "failed") { pc.restartice(); } }; with this improved technique, instead of directly calling onnegotiationneeded with options to trigger ice restart, the failed ice connection state simply calls restartice().
WebRTC API - Web APIs
WebAPIWebRTC API
connectionstatechange the connection's state, which can be accessed in connectionstate, has changed.
... iceconnectionstatechange sent to an rtcpeerconnection when its ice connection's state—found in the iceconnectionstate property—changes.
RTCPeerConnection.connectionState - Web APIs
WebAPIRTCPeerConnectionconnectionState
when this property's value changes, a connectionstatechange event is sent to the rtcpeerconnection instance.
RTCPeerConnection.iceConnectionState - Web APIs
WebAPIRTCPeerConnectioniceConnectionState
you can detect when this value has changed by watching for the iceconnectionstatechange event.