Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript WebRTC Chrome和Firefox connection.setRemoteDescription_Javascript_Google Chrome_Firefox_Webrtc - Fatal编程技术网

Javascript WebRTC Chrome和Firefox connection.setRemoteDescription

Javascript WebRTC Chrome和Firefox connection.setRemoteDescription,javascript,google-chrome,firefox,webrtc,Javascript,Google Chrome,Firefox,Webrtc,以下是我如何接受创建的报价并创建答案: var description = new RTCSessionDescription(sdp), self = this; connection.setRemoteDescription(description, function () { connection.createAnswer(function (answer) { try { connection.setLocalDescription(answer, fun

以下是我如何接受创建的报价并创建答案:

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浏览器之间启动会话时,一切正常。

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

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

您使用的浏览器版本和操作系统分别是什么?