gpt4 book ai didi

javascript - WebRTC Chrome 和 Firefox connection.setRemoteDescription

转载 作者:搜寻专家 更新时间:2023-11-01 04:08:53 24 4
gpt4 key购买 nike

以下是我接受创建的报价并创建答案的方式:

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

不幸的是,当我在 Chrome 中通过 Firefox 创建报价时,我得到:

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

在 Firefox 中,我通过以下方式启动连接:

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

我创建的对等连接:

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

当我尝试启动 Chrome 浏览器之间的 session 时,一切正常。

最佳答案

尝试将 rtpDataChannel 设置为 false 并删除 DtlsSrtpKeyAgreement。

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

关于javascript - WebRTC Chrome 和 Firefox connection.setRemoteDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25320204/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com