Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,How are you?
I have a question
Would you help me
I want to Sharing screen with webrtc
my code in share.js
JavaScript
var screen_constraints = {
    mandatory: {
        chromeMediaSource: 'screen',
        maxWidth: 1920,
        maxHeight: 1080,
        minAspectRatio: 1.77
    }
};

var session = {
    audio: false,
    video: screen_constraints
};


navigator.getUserMedia = navigator.getUserMedia ||
  navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

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

function successCallback(localMediaStream) {
    window.stream = localMediaStream; // stream available to console
    var video = document.querySelector("video");
    video.src = window.URL.createObjectURL(localMediaStream);
    video.play();
}

function errorCallback(error) {
    console.log("navigator.getUserMedia error: ", error);
}

navigator.getUserMedia(session, successCallback, errorCallback);

and my code in html page
HTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- head; this <link> tag MUST be in <head> section -->


    <script src="Scripts/test.js"></script>


</head>
<body>
   <video autoplay style="height:400px;width:400px"></video>
</body>
</html>

when i run it on localhost
the error was
' NavigatorUserMediaError ' is error message

What do you think?
can you help me?
thankyou
Posted
Updated 19-Jan-15 19:45pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900