0

I started WebRTCPeerConnection.addTrack() after the peer connection was established.

However, when implemented like this, the ontrack event did not occur.

Does the media track have to be added before the peer connection starts?

Is there any way to add media tracks in webrtc after peer connection is established?

GBG
  • 13
  • 3

2 Answers2

0

You can add tracks after establishing the connection but need to renegotiate, i.e. create another offer, send it to the peer and get an answer back.

The webrtc upgrade sample illustrates this for adding a video track.

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
0

Their is not much information in your question. But i will try to guess the possible solution.

  • check whether you are adding local tracks to your peer before creating offer or answer.

  • Make sure your addTrack is in the memory before the exchange of offer , answer , candidate happens.

aditya
  • 66
  • 4