【问题标题】:Screen Sharing in kurento issueskurento 问题中的屏幕共享
【发布时间】:2021-07-18 18:52:16
【问题描述】:

在 kurento 媒体服务器中面临屏幕共享问题

我正在关注 kurento-java-tutorials (one2many)。这是我在客户端的演示者功能

function presenter() {
    if (!webRtcPeer) {
        showSpinner(video);

 var constraints = {
     audio: false,
     video: {
       width : { max : 320 },
       height : { max :  240 },
       framerate : { exact : 15 }
     }
 };

        var options = {
        //  localVideo : video,
        videoStream : video,
            onicecandidate : onIceCandidate,
            mediaConstraints : constraints,
            sendSource : 'screen'
        }
        console.log(options);
      if(navigator.getDisplayMedia || navigator.mediaDevices.getDisplayMedia) {
          function onGettingSteam(stream) {

              video.srcObject = stream;
    
          }

          if(navigator.mediaDevices.getDisplayMedia) {
           
              navigator.mediaDevices.getDisplayMedia({video: true}).then(stream1 => {


                onGettingSteam(stream1);
options.localVideo=stream1;
              }, getDisplayMediaError).catch(getDisplayMediaError);
          }
          else if(navigator.getDisplayMedia) {
              navigator.getDisplayMedia({video: true}).then(stream2 => {
                  onGettingSteam(stream2);
options.localVideo=stream2;

              }, getDisplayMediaError).catch(getDisplayMediaError);
          }
      }
      else {

      }



        webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options,
                function(error) {
                    if (error) {
                        return console.error(error);
                    }
                    webRtcPeer.generateOffer(onOfferPresenter);
                });

        enableStopButton();
    }
}

我没有在查看器端获得视频流。在查看器端的控制台上它说

呼叫不被接受,原因如下:现在没有活动的发件人。成为发件人或。稍后再试...

【问题讨论】:

    标签: webrtc kurento kurento-media-server


    【解决方案1】:

    我们可以使用https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia的startCapture()

    这对我们有用:

    startCapture({video: true}).then(stream => {
        
        video.srcObject = stream;
        
        var cstrx = {
            audio: false,
            video: {
                width : { max : 640 },
                height : { max :  480 },
                framerate : { exact : 15 }
            }
        };
    
            var options = {
            videoStream: stream,
            onicecandidate: participant.onIceCandidate.bind(participant),
            mediaConstraints : cstrx,
            sendSource : 'screen'
            }
        
            participant.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options,
    ...
    

    这意味着我们必须等待流,否则我们会得到空的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-03
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      • 1970-01-01
      • 2018-08-03
      • 1970-01-01
      相关资源
      最近更新 更多