How do I know if pc.onnegotiationneeded was started because the thread was deleted?

I am dealing with RTCPeerConnection ( pc ) which has an event handler named onnegotiationneeded .

" onnegotiationneeded " is triggered when a full media stream is added or removed using pc.addStream or pc.removeStream .

Is it possible to indicate inside the function onnegotiationneeded if it was executed because the stream was added or deleted? Because, reading the documents, I could not find for this state.

I am currently switching the flag when I do pc.addStream or pc.removeStream . This flag helps me inform onnegotiationneeded if it was caused by the removal of the stream or not.

But I was wondering if there is such a property given by the browser (Chrome 40 or Firefox 36) API?

+8
javascript html5 webrtc sdp
source share
1 answer

The MDN documentation for the onnegotiationneeded handler indicates:

This should be set up for the function that you provide, which is passed to a single parameter: an Event object containing an event related to the negotiation. In this case, additional information is not provided; All that you need, you can get by studying the properties of RTCPeerConnection.

Basically, you cannot do this with just a callback. But you can use it with an onstreamadded or onstreamremoved

You can find a convenient solution for tracking added tracks and streams here .

0
source share

All Articles