javascript - Getting "ScreenCaptureError" in Chrome using Kurento Media Server - Stack Overflow

I'm trying to share my screen with Kurento WebRtc server. But getting this error: NavigatorUserMed

I'm trying to share my screen with Kurento WebRtc server. But getting this error:

NavigatorUserMediaError {name: "ScreenCaptureError", message: "", constraintName: ""}

There is no errors in Firefox with same code. Constraints using for webrtc:

    var constraints = {
        audio: true,
        video: {
            mandatory : {
                chromeMediaSource: 'screen',
                maxWidth: 1920,
                maxHeight: 1080,
                maxFrameRate: 30,
                minFrameRate: 15,
                minAspectRatio: 1.6
            },
            optional: []
        }
    }

    var options = {
           localVideo : video,
           onicecandidate : onIceCandidate,
           mediaConstraints : constraints
    }
    webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options,function(error) {
       if (error) {
           return console.error(error);
       }
       webRtcPeer.generateOffer(onOfferPresenter);
    });

How do I share my screen using chrome and kurento?

I'm trying to share my screen with Kurento WebRtc server. But getting this error:

NavigatorUserMediaError {name: "ScreenCaptureError", message: "", constraintName: ""}

There is no errors in Firefox with same code. Constraints using for webrtc:

    var constraints = {
        audio: true,
        video: {
            mandatory : {
                chromeMediaSource: 'screen',
                maxWidth: 1920,
                maxHeight: 1080,
                maxFrameRate: 30,
                minFrameRate: 15,
                minAspectRatio: 1.6
            },
            optional: []
        }
    }

    var options = {
           localVideo : video,
           onicecandidate : onIceCandidate,
           mediaConstraints : constraints
    }
    webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options,function(error) {
       if (error) {
           return console.error(error);
       }
       webRtcPeer.generateOffer(onOfferPresenter);
    });

How do I share my screen using chrome and kurento?

Share Improve this question asked Apr 7, 2016 at 19:33 morozRedmorozRed 1764 silver badges14 bronze badges 3
  • Chrome can only share screen through a Chrome Extension. Which one are you using? – igracia Commented Apr 7, 2016 at 20:30
  • I'm using extension by Muaz Khan – morozRed Commented Apr 7, 2016 at 21:06
  • @igracia, I just can't find a way how to use extension with kurento – morozRed Commented Apr 7, 2016 at 21:12
Add a ment  | 

1 Answer 1

Reset to default 9

Sharing a screen with Kurento through WebRTC, is exactly the same as sharing the webcam: get the stream from the client and negotiate the endpoint. The tricky part when doing screenshare is to get the stream. The kurento-utils-js library will give you a little help on that, as you can create the WebRtcPeer object, in the client, indicating that you want to share your screen or a window. You just need to make sure that you

  • have an extension installed to do screen-sharing in Chrome. In FF, it's enough to add the domain to the whitelist. Check this extension.
  • pass a valid sendSource value (screen or window) in the options bag when creating the kurentoUtils.WebRtcPeer object
  • have a getScreenConstraints method in your window object, as it will be used here. getScreenConstraints should return a valid set of constraints, depending on the browser. YOu can check an implementation of that function here

I think that should be enough. We are doing screen sharing with the library, using our own getScreenConstrains and extension, and it works fine. Once you have that, doing screen sharing with the kurento-utils-js library is quite easy. Just need to pass the sendSource value when creating the peer like so

 var constraints = {
   audio: false,
   video: true
 }

 var options = {
   localVideo: videoInput, //if you want to see what you are sharing
   onicecandidate: onIceCandidate,
   mediaConstraints: constraints,
   sendSource: 'screen'
 }

 webRtcPeerScreencast = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
   if (error) return onError(error) //You'll need to use whatever you use for handling errors

   this.generateOffer(onOffer)
 });

The value of sendSource is a string, and it depends on what you want to share

  • 'screen': will let you share the whole screen. If you have more than one, you can choose which one to share
  • 'window': lets you choose between all open windows
  • [ 'screen', 'window' ]: WARNING! Only accepted by Chrome, this will let the user choose between full screens or windows.
  • 'webcam': this is the default value of you don't specify anything here. Guess what'll happen ;-)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742348127a4426962.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信