Screen Sharing Webrtc and Kurento

3,488 views
Skip to first unread message

Tomas Belskis

unread,
Jan 23, 2016, 2:41:40 PM1/23/16
to kurento
I'm looking for examples for screen sharing with kurento i have found one that is for kurento 5.14 the screen recorder example but it's quite outdated considering now you need to use an extension for webrtc screenshare, could anyone give me some pointers on how i could execute screenshare with kurento on top of the one 2 many call example? thanks in advance. 

Tomas Belskis

unread,
Jan 25, 2016, 7:37:46 PM1/25/16
to kurento
Update: I got an extension working to capture the screen and i'm able to redirect it to the video tag, so now what i would like to do is stream both webcam feedback and screen cast per viewer, so using the one2many example as a base a presenter would stream both video cam footage and screen share to N viewers, how would i go by doing this, is it possible to have 2 webrtc endpoints for the viewer do i need 2 webrtcendpoints for presenter too? because i'm passing 2 streams ? is it possbile to pass 2 streams through a single endpoint ? i haven't tested this yet but wouldn't want to waste my time in attempts with this if someone has already done something similar.

Ivan Gracia

unread,
Jan 26, 2016, 9:49:49 AM1/26/16
to Kurento Public
I'm afraid not yet. For now, you'll have to create two different endpoints.

Ivan Gracia



--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tomas Belskis

unread,
Jan 27, 2016, 11:55:45 AM1/27/16
to kurento
Just a quick question, about getting the screen share stream would i need to create a different pipeline for the stream so 2 pipelines or is possible to have more then 1 end point for both sides on a single pipeline and would there be the need for a hub ? I'm reading the documents and examples and i seen the advanced call example using 2 pipelines one for normal stream communication and other one for replay ability of the recorded stream would this be the case with just dealing with 2 streams too ? or a single pipeline is sufficient ? thanks in advance 


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:

Ivan Gracia

unread,
Jan 27, 2016, 11:59:37 AM1/27/16
to Kurento Public
You can have more than one endpoint for each client, The pipeline doesn't really care where the stream is coming from :-) Actually, having two different pipelines will prevent one endpoint seeing the video from the other, as there is no media exchange between pipelines.

Ivan Gracia



--

Tomas Belskis

unread,
Jan 28, 2016, 7:46:04 PM1/28/16
to kurento
Hi, I didn't test the extension to actually send the stream to kurento server, so now i have errors with it and i just can't figure out how to get it to work with kurento utils, this is the extension that i used for screen capture https://github.com/webrtc/samples/tree/master/src/content/extensions/desktopcapture can be found here which was linked in one of the other threads, the error i get when i try to start screen share is included in picture and also a screenshot of the code piece. I really have no idea where to find resources on this ? is there anything i could read to make me understand how this works ? I'm really new to this and have been reading a lot of documents on kurento and webrtc but still have difficulty understanding how it works. I tried changing the options that are being passed on over but it had no effect. Help is really appreciated as i'm really starting to stress over this as i need to implement webcam stream and screen share streams 1 to n users by next tuesday and i keep running into roadblocks. Thank you so much for helping me so far really thankful for your time answering my low questions.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:
Screen Shot 2016-01-29 at 00.36.09.png
Screen Shot 2016-01-29 at 00.37.20.png

Ivan Gracia

unread,
Jan 29, 2016, 4:01:22 AM1/29/16
to Kurento Public

Those options are not OK for adapter.js, and that’s what that message is telling you. Try something like this

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

 var options = {
   localVideo : videoInput,
   onicecandidate : onIceCandidate,
   mediaConstraints : constraints,
   sendSource : 'screen'
 };

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 anyhting here. Guess what'll happen ;-)


Ivan Gracia



--

Tomas Belskis

unread,
Jan 29, 2016, 7:53:41 AM1/29/16
to kurento
Ok thanks that seemed to work, really stupid of me i saw that example in your documents but lost it before and forgot to try it, but now i get an error in relation to getScreenConstraint within kurento-utils, it says it's undefined, i read that you can you either define the getScreenConstrain or download the kurento-browser-extension but i can't find where to download that. If i were to define the getScreenConstraint ? how would i go about doing that, i can't find any information on this subject, does it have to be defined within index.js or i have to edit kurento-util js ? i attached a screen shot of the error i'm getting. Sorry to bother you this much about this.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:
Screen Shot 2016-01-29 at 12.46.29.png

Ivan Gracia

unread,
Jan 29, 2016, 8:40:58 AM1/29/16
to Kurento Public
No worries! Getting those constraints right for the first time is not straightforward.

It's a script that you need to add yourself. There is an implementation of that function here. There are also a number of posts in the list about screen-sharing, if you want to have a look around.

Ivan Gracia



--

Tomas Belskis

unread,
Jan 29, 2016, 5:40:57 PM1/29/16
to kurento
I have created the function within index.js, and i set the SourceId that has been generated by the extension after you select which window you want to stream, but after this i don't get any errors, but also there is no offer send and nothing happens the stream is not being streamed. The function created returns screen_constraints. What could i be doing wrong? I'm really desperate to get this working, thanks for your help.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:
Screen Shot 2016-01-29 at 22.37.34.png
Screen Shot 2016-01-29 at 22.38.11.png

Tomas Belskis

unread,
Feb 1, 2016, 10:13:24 AM2/1/16
to kurento
I tried using a different extension and script but there was no difference, I'm really stuck to get this working, any help appreciated. In my understand when a different source is sent than webcam, the kurento-utils calls the getConstraint function which has to return valid constraints and sourceId from the extension all together to create a valid sdpoffer and create a peer. But my function does return valid constraints and a screenId from the extension and still nothing get's processed. What else am I missing ? I have read the other questions in relation to screen sharing, that have been posted here and tried using the methods that were described there but still no use, I think i'm missing vital piece of information that is causing me to miss understand how to achieve screen sharing with kurento.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:

Ivan Gracia

unread,
Feb 1, 2016, 12:33:02 PM2/1/16
to kurento
Can you paste the constraints that your extension return? It's interesting to see the value that is passed to the getUserMedia function. Also, you should get some exception in the client.
--

Tomas Belskis

unread,
Feb 1, 2016, 7:52:55 PM2/1/16
to kurento
I have finally got it working thanks for all your help really appreciate it.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:

Ivan Gracia

unread,
Feb 2, 2016, 3:52:25 AM2/2/16
to kurento
Cool! Good to know :-) how did you manage?
--

Tomas Belskis

unread,
Feb 3, 2016, 5:19:38 PM2/3/16
to kurento
The issue wasn't with the constraints, the issue was caused by the extension and the sourceId after you select the screen not a valid sourceId was being passed in that's why there were no errors after i selected the screen with the extension but it didn't work. I messed around with the extension and re wrote one of the functions to return SourceId and it worked.


On Saturday, 23 January 2016 19:41:40 UTC, Tomas Belskis wrote:
Message has been deleted
Message has been deleted
Message has been deleted

akshay...@gmail.com

unread,
Feb 25, 2016, 1:06:55 AM2/25/16
to kurento
Hi,
I am also stuck at the same point.
I am trying to implement the screen stream in the kurento-hello-world-java tutorial.

I get a valid sourceid also there are no errors displayed. Also no exchange of sdp offers takes place.
I am not able to see the screenshare stream in any of the video tags. Neither local video tag nor remote. 
What could I be doing wrong. Any help would be really appreciated.

Following are the constraints returned by the getScreenContraints function:

chrome: {"mandatory":{"chromeMediaSource":"screen","maxWidth":1920,"maxHeight":1080},"optional":[],"audio":false,"video":{"mandatory":{"maxWidth":320,"maxHeight":240,"minFramerate":15,"maxFramerate":15}}}

I am making use of the following extension: https://github.com/muaz-khan/Chrome-Extensions/tree/master/desktopCapture

Please Help...
Thanking you,

Юрий Тимофеев

unread,
Mar 19, 2017, 3:49:56 PM3/19/17
to kurento, akshay...@gmail.com
Was it possible to make it work?

abhimanyu aggarwal

unread,
May 24, 2018, 1:43:48 AM5/24/18
to kurento
Hi Tomas

I have to the same problem. If you don't mind can you please share the code that you used to get it going. Sorry on a tight deadline would appreciate your quick response

On Thursday, February 4, 2016 at 3:49:38 AM UTC+5:30, Tomas Belskis wrote:

abhimanyu aggarwal

unread,
May 24, 2018, 1:45:21 AM5/24/18
to kurento
Also does it work on every browser. Can't we do it without using any extension.

Thanks

Paulo R. Lanzarin

unread,
May 25, 2018, 8:15:47 PM5/25/18
to kur...@googlegroups.com
Hi Abhimanyu,

This is not much of an issue with Kurento as it is with the browser WebRTC API.

Screensharing on chrome isn't possible without an extension; that's a limitation the Google
folks decided to enforce as to guarantee that only allowed domains will fetch your screen.
Firefox won't need an extension, though.

For a valid extension code, there are a myriad of examples online. There are two I like:
https://github.com/muaz-khan/Chrome-Extensions/tree/master/desktopCapture and a 
simpler but very nice one from the BigBlueButton folks: https://github.com/bigbluebutton/screenshare-chrome-extension.

Please, make sure you set the valid domains of your server in manifest.json.

s,

Paulo.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.
To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/c56a5a40-014c-49f4-9e32-df12f14e5782%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages