Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC Chrome and Firefox connection.setRemoteDescription

Here is how I accept the created offer and create an answer:

var description = new RTCSessionDescription(sdp),
    self = this;
connection.setRemoteDescription(description, function () {
  connection.createAnswer(function (answer) {
    try {
      connection.setLocalDescription(answer, function () {
        self._mediator.sendSDPAnswer({
          data: answer,
          connection: connection.id
        });
        self._isRemoteDescriptionSet[connection.id] = true;
        self._setIceCandidates(connection);
      });
    } catch (e) {
      self._logger.error('Error while setting the remote description', e);
    }
  }, function (error) {
    throw error;
  }, {
    mandatory: {
      OfferToReceiveVideo: false,
      OfferToReceiveAudio: true
    }
  });

Unfortunately when I create the offer by Firefox in Chrome I get:

Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs.. 

In Firefox I initiate the connection by:

  connection.createOffer(function (offer) {
    connection.setLocalDescription(offer, function () {
      mediator.sendSDPOffer({
        data: offer,
        connection: connection.id
      });
    });
  }, function (error) {
    throw new Error('Error while connecting', error);
  }, {
    mandatory: {
      OfferToReceiveVideo: false,
      OfferToReceiveAudio: true
    }
  });

The peer connection I create by:

  this._connection = new RTCPeerConnection(servers,
    { optional: [
      { RtpDataChannels: true },
      { DtlsSrtpKeyAgreement: true }
    ]});

When I try to initiate the session between Chrome browsers everything works.

like image 431
Josh Long Avatar asked Aug 15 '14 01:08

Josh Long


People also ask

What is setRemoteDescription?

setRemoteDescription() The RTCPeerConnection method setRemoteDescription() sets the specified session description as the remote peer's current offer or answer. The description specifies the properties of the remote end of the connection, including the media format.

What is renegotiation WebRTC?

Renegotiation is a process allows you modify pre-created peer connections when you want to: append additional streams. remove existing streams. modify SDP for peers direction or something else.

What is WebRTC offer?

When a user starts a WebRTC call to another user, a special description is created called an offer. This description includes all the information about the caller's proposed configuration for the call. The recipient then responds with an answer, which is a description of their end of the call.


1 Answers

Try to set rtpDataChannel to false and remove the DtlsSrtpKeyAgreement.

this._connection = new RTCPeerConnection(servers,
  { optional: [
  { RtpDataChannels: false }
]});
like image 80
Alex Zai Avatar answered Oct 12 '22 09:10

Alex Zai