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.
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.
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.
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.
Try to set rtpDataChannel to false and remove the DtlsSrtpKeyAgreement.
this._connection = new RTCPeerConnection(servers,
{ optional: [
{ RtpDataChannels: false }
]});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With