WebRTC Chrome and Firefox connection.setRemoteDescription

This is how I accept the created proposal and create the 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 a Firefox suggestion 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 a connection:

  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 } }); 

Peer-to-peer connection that I create:

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

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

+5
source share
1 answer

Try setting rtpDataChannel to false and remove DtlsSrtpKeyAgreement.

 this._connection = new RTCPeerConnection(servers, { optional: [ { RtpDataChannels: false } ]}); 
+5
source

Source: https://habr.com/ru/post/1200374/


All Articles