share screen

804 views
Skip to first unread message

Gonzalo Amadio

unread,
May 20, 2014, 12:34:45 PM5/20/14
to eas...@googlegroups.com
Hello, I am trying to run the share screen demo. But I am having this error:

Error messages
Error getting local media stream: MEDIA_ERR

I tried it on my pc, and also the same error. I have attached a tar.gz with the files I am testing on. In there, there are the files from with code from the example + server + certs for https.

Also another question. What about "turning of" the screen sharing, I mean, I want to have a button for video calling, and another for screen sharing.
I can achieve this by doing the following?: 

easyrtc.enableVideo(true);

So I can toggle between screen sharing or video doing:
easyrtc.enableVideo(true); //if I want video, or
easyrtc
.setScreenCapture(); //if I want screen sharing.


Do someone has a working example to share?

Thank a lot!
Gonzalo.
shareScreen.tar.gz

Emilio López

unread,
May 20, 2014, 1:23:01 PM5/20/14
to eas...@googlegroups.com
Gonzalito! Welcome back, pal. Are you running the app on an HTTPS server?! I suggest you run the server example shipped with easyrtc on an https enviroment and run the demo for screen sharing. I'm sure you will be able to take it from there.

EMILIO!

Gonzalo Amadio

unread,
May 20, 2014, 1:26:30 PM5/20/14
to eas...@googlegroups.com
Hello Emilio!.
Yes I do. Check the attached files. =)
I run it on an https server, but also the same error.

Emilio López

unread,
May 20, 2014, 1:32:38 PM5/20/14
to eas...@googlegroups.com
Yeah but I meant, for the sake of it, enable the demos and check if you can use the demos already shipped. In the server.js comment the line

easyrtc.setOption("demosEnable",false);


and surf on your browser:


Did you already try that and got the same error message!?

EMILIO!

Gonzalo Amadio

unread,
May 20, 2014, 1:40:21 PM5/20/14
to eas...@googlegroups.com
Yep. I will try it on windows, and I'll tell you =)

Gonzalo Amadio

unread,
May 20, 2014, 2:47:37 PM5/20/14
to eas...@googlegroups.com
I tried it on windows xp, and have the same error. =(

Also on peer on windows xp and another on Ubuntu, and the same error. Both in the same Wan

Eric Davies

unread,
May 20, 2014, 3:33:03 PM5/20/14
to eas...@googlegroups.com
Check your chrome://flags.
You should find the following item which you may need to enable:

Enable screen capture support in getUserMedia(). Mac, Windows, Linux, Chrome OS
Allow web pages to request access to the screen contents via the getUserMedia() API. #enable-usermedia-screen-capture

Gonzalo Amadio

unread,
May 20, 2014, 3:48:26 PM5/20/14
to eas...@googlegroups.com
Nop either. Same error. I am the only one having it?
Eric, for you is working?

Gonzalo Amadio

unread,
May 20, 2014, 4:08:10 PM5/20/14
to eas...@googlegroups.com
Ok. 

I also enable: 
And the demo work.


What about implementint it? should I wait David?
Or how should I include it into my code.

Some relevant piece of code I have :

easyrtc.easyApp(
       
"MyApp",
       
"selfVideo",
        videoIds
,
        loginSuccess
,
        loginFailure
);


easyrtc.setAcceptChecker(acceptCheckP2P);


function acceptCheckP2P(caller, cb) {
    document
.getElementById('acceptCallBox').style.display = "block";
    document
.getElementById('acceptCallLabel').innerHTML = "Accept call from " + easyrtc.idToName(caller) + " ?";

   
//Handler for decision.
   
var acceptTheCall = function(wasAccepted) {
       
//call accepted
       
if(wasAccepted){
            enable
('hangupButton');
            document
.getElementById(talkingTo).className="connected";
       
}
       
//hang up other calls
       
if( wasAccepted && easyrtc.getConnectionCount() > 0 ) {
            easyrtc
.hangupAll();
       
}
        document
.getElementById('acceptCallBox').style.display = "none";
        cb
(wasAccepted);
   
};
    document
.getElementById("callAcceptButton").onclick = function() {
        acceptTheCall
(true);
   
};
    document
.getElementById("callRejectButton").onclick =function() {
        acceptTheCall
(false);
   
};            
}






Gonzalo Amadio

unread,
May 22, 2014, 10:18:02 AM5/22/14
to eas...@googlegroups.com
I tried to share screen, but with no success. I left more code.


function connect() {
 

    easyrtc
.enableAudio(false);
    easyrtc
.enableVideo(false);
    easyrtc
.setScreenCapture();

    easyrtc
.easyApp(
       
"MyApp",
       
"selfVideo",
        videoIds
,
        loginSuccess
,
        loginFailure
);



    easyrtc
.enableDataChannels(true);
    easyrtc
.setRoomOccupantListener(convertListToButtons);
    easyrtc
.setAcceptChecker(acceptCheckP2P);
}




function loginSuccess(easyrtcId) {
    updateConnectedToRoomAndStatus
("default");
    easyrtc
.getRoomList(convertRoomsToList, errorList);
    easyrtc
.setDisconnectListener(function(){
       easyrtc
.showError("SYSTEM-ERROR", "Se perdió la conexión al socket server");
   
});
   
//enable receiving files
    easyrtc_ft
.buildFileReceiver(acceptRejectCB, blobAcceptor, receiveStatusCB);
}

function loginFailure(errorCode, message) {
   
var reloadPage = setTimeout(function(){document.location.reload(false)},2000);
    console
.log("Failed to connect. errorCode: "+errorCode+"\n message: "+message);
}
easyrtc.onError = function(errorObject) {
    console
.log("I am into onError conferencias");
    console
.log(errorObject.errorText);
   
};


And I have the error: 


getusermedia failed easyrtc.js:1354
I am into onError conferencias . Failed to get acces to local media. Error code was undefinedconferencias.js:90

Failed to connect. errorCode: MEDIA_ERR message: Failed to get access to local media. Error code was undefined.

Despite I could execute the demo kind of fine.








numb3...@gmail.com

unread,
May 24, 2014, 6:31:34 PM5/24/14
to eas...@googlegroups.com
I have the identical error of Gonzalo

Eric Davies

unread,
May 27, 2014, 9:40:22 AM5/27/14
to eas...@googlegroups.com
As soon as I have time, I'll put up a new demo that does just screen capturing (no sharing) since that seems to a sticking point. It will be sometime next week as I'm racing to finish another project at the moment.

Eric.

Tolik

unread,
Jul 26, 2014, 5:36:59 PM7/26/14
to eas...@googlegroups.com
Hi Eric,

What about this example on the screen sharing (capturing)? I am confused by the api you put in betta. initScreenCapture() does not seem to have sense.
I would like to see this solution: https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/desktopCapture
What do you think about it?
Greetings,
Tolik

Eric Davies

unread,
Jul 27, 2014, 12:06:44 AM7/27/14
to eas...@googlegroups.com
Hi Tolik,

Please ignore the body of intScreenCapture I put in the beta. The intent was that initScreenCapture would be like initMediaSource but for screen captures. At the time I entered it, I had a mistaken idea of how chrome extensions worked, then I discovered they worked in a different way, and never got around to removing it.

Eric.

Tolik

unread,
Aug 1, 2014, 2:16:32 AM8/1/14
to eas...@googlegroups.com
Hi Eric,

I would like to contibute some code on screen sharing. I used this interesting solution from "muaz-khan": https://github.com/muaz-khan/WebRTC-Experiment/tree/master/getScreenId.js

You need to install his extension and use his js. Then:

In easyrtc.js replace:

            setTimeout
(function () {
               
try {
                    firstCallTime
= getCurrentTime();
                    getUserMedia
(mode, onUserMediaSuccess, tryAgain);
               
} catch (e) {
                    tryAgain
(e);
               
}

with:
           
 setTimeout(function () {
               
try {
                    firstCallTime
= getCurrentTime();
                   
if (easyrtc.screenSharing) { // ------------------- screen sharing condition ----------------------
                        getScreenId
(function (error, sourceId, screen_constraints) {
                           
// error    == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome'
                           
// sourceId == null || 'string'

                            screen_constraints
= {
                                video
: {
                                    mandatory
: {
                                        chromeMediaSource
: 'screen',
                                        maxWidth
: 1920,
                                        maxHeight
: 1080,
                                        minAspectRatio
: 1.77
                                   
}
                               
}
                           
};

                           
if (error === 'permission-denied') return alert('Permission is denied.');
                           
if (error === 'not-chrome') return alert('Please use chrome.');

                           
if (!error && sourceId) {
                                screen_constraints
.video.mandatory.chromeMediaSource = 'desktop';
                                screen_constraints
.video.mandatory.chromeMediaSourceId = sourceId;
                           
}

                            getUserMedia
(screen_constraints, onUserMediaSuccess, function (error) {
                                console
.error(error);
                           
});
                       
});
                   
} else {
                        getUserMedia
(mode, onUserMediaSuccess, tryAgain);
                   
}
               
} catch (e) {
                    tryAgain
(e);
               
}

It still has to be put in the scope of easyrtc, but it works. The only problem is that if I use setSdpFilters there is an error if the screen sharing user calls. Still it works if you call to the screen sharing user, and without the filters it works both ways.

This is where I have an error if the screen sharing user calls:


       
try {
           
if (sdpRemoteFilter) {
                sd
.sdp = sdpRemoteFilter(sd.sdp);
           
}
            pc
.setRemoteDescription(sd, invokeCreateAnswer, function (message) {
               
self.showError(self.errCodes.INTERNAL_ERR, "set-remote-description: " + message);
           
});
       
} catch (srdError) {
            console
.log("set remote description failed");
           
if (self.debugPrinter) {
               
self.debugPrinter("saw exception in setRemoteDescription");
           
}
           
self.showError(self.errCodes.INTERNAL_ERR, "setRemoteDescription failed: " + srdError.message);
       
}

Please, check the problem and it would be nice if you could implement this solution. Maybe, as another function that can be modified externally.

We still have to have the option for own extention, as I mentioned in the previous post.

Thanks,
Tolik

Eric Davies

unread,
Aug 6, 2014, 12:41:18 AM8/6/14
to eas...@googlegroups.com
Hi Folks,

Just wanted to let you know that Team EasyRTC has been working hard on getting the beta branch ready to become the new master branch, not purposely ignoring this dialog :-). The work involved a number of fixes to edge cases that multi-stream support broke, so if you are using the beta branch, you'll want to pull down the latest version sometime tomorrow because it will be more stable than what was out prior to today. After we've got that pushed out (and fixed any other new issues people find), I'll look into pulling the most compatible desktop capture code that's been worked on into the next beta branch.

We'll probably need to extend the sdp filters parameters a bit so you can tell when you are getting desktop captures and avoid filtering them. 

My thoughts for desktop capture: it should let you specify what chrome extension is used, with the default being an  priologic/easyrtc or muaz khan controlled one, but the ability to specify one that you (the application developer) controls. If it needs an iframe, there should be a default option of adding that to the document transparently to the application developer so "it just works". I'd prefer that api be a modified copy of initMediaSource with a new name rather than an extension to initMediaSource; it will be easier to document and more visibile to new users in the documentation. If we use your code as part of EasyRTC, I'm told we need to get you to sign off on it (to give us written permission to include it under our copyright) so we're covered legally.

Eric.
Reply all
Reply to author
Forward
0 new messages