【问题标题】:WebRTC111 error: DOMException [InternalError: "Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannelWebRTC111 错误:DOMException [InternalError:“无法创建没有本地曲目、没有 offerToReceiveAudio/Video 和没有 DataChannel 的报价
【发布时间】:2016-11-08 21:29:12
【问题描述】:

我正在使用 webrtc+janusgateway+streamCapture 构建流媒体服务。

这,开始流式传输视频:

  public streamVideo() {
    var video = $('#video1').get(0);
        var stream;

    video.onplay = () => {
      if (video.captureStream) {
        stream = video.captureStream();
      } else if (video.mozCaptureStream) {
        stream = video.mozCaptureStream();
      } else {
        alert('captureStream() not supported');
      }

            console.log(stream);
      $("#secondvideoforll").get(0).srcObject = stream;

    this.sfutest.createOffer(
      {
        media: { audioRecv: 0, videoRecv: 0, audioSend: 1, videoSend: 1}, // Publishers are sendonly
        stream: stream,
        success: (jsep) => {
          Janus.debug("Got publisher SDP!");
          Janus.debug(jsep);
          var publish = { "request": "configure", "audio": 1, "video": 1 };
          this.sfutest.send({"message": publish, "jsep": jsep});
        },
        error: (error) => {
          Janus.error("WebRTC111 error:", error);
        }
      });
    }
  }

视频播放效果很好,但是当我尝试创建报价(以及进一步的 addStream)时。我收到此错误:

WebRTC111 error: DOMException [InternalError: "Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel."
code: 0
nsresult: 0x0]

相同的报价创建(不带 stream 参数)适用于网络摄像头流式传输,但不适用于视频流式传输。

我发现的主要区别是网络摄像头使用:LocalMediaStream,而我的 streamCapture 使用 MediaStream。

对此有什么想法吗?

【问题讨论】:

    标签: webrtc janus-gateway


    【解决方案1】:

    调用 video.captureStream() 时 getTracks() 返回空数组,但 1.5 秒后,它按预期返回轨道。

    如果没有添加曲目,则会产生错误:WebRTC111 error: DOMException [InternalError: "Cannot create an offer with no local tracks, no offerToReceiveAudio/Video, and no DataChannel

    出于文档目的添加此内容,因为其他人可能会感到困惑。

    解决方案:

    setInterval(function(){
    // We wait till the mediaTracks are added to mediaStream
    console.log(stream.getTracks());
    // Further actions with the mediaStream
    }, 1000);
    

    谢谢!

    参考:https://github.com/w3c/webrtc-pc/issues/923

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-07
      • 2020-04-10
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      相关资源
      最近更新 更多