SIP.js screen sharing

387 views
Skip to first unread message

gilbert....@gmail.com

unread,
Mar 4, 2019, 1:52:51 PM3/4/19
to SIP.js
Hi there,

I have been successful in getting sip JS to work through a browser and on a Cordova app. I am using FreeSWITCH for my backend.

I would like to implement a screen sharing feature that allows a user to share they're instead of their webcam. I would prefer if it could be done during the middle of a session.

Has anyone been successful in accomplishing this yet? If so, can you please point me to some code?

Thanks,

Gil

martsa...@gmail.com

unread,
Sep 11, 2019, 3:28:27 AM9/11/19
to SIP.js
Hi Gil

I am planning to build a webrtc call support for Android app using cordova frame with sip.js library. i had created same with some other commerical library in the past ,but not with sip.js . i dont see any 
support on sip.js tutorial. So wish to ask does webrtc all through sip.js in cordova frame work support , if so do i need some plugin as well. so any form of suggestion would be of great help. 

regards
Lobsang

okai...@gmail.com

unread,
Oct 4, 2019, 2:35:16 AM10/4/19
to SIP.js
hey gil , i know its an old post and i hope that u will see this reply
but have u solved screen sharing with sipjs ? 
i managed to get the screen sharing for user 1 and played it in video element.
but the most important thing is how to send this stream to user 2
 
pls if u managed to make it work , if u can share some code pls , my project stopped on it.

thank u so much

Clement Pradeep

unread,
Oct 10, 2019, 8:01:42 AM10/10/19
to SIP.js
Hey okai...
This might help you, you have to replace the track:

to start screen share:
var option = {video: {mediaSource: 'screen'}, audio: true};
navigator.mediaDevices.getDisplayMedia(option)
.then(function(streams){
  var videoTrack = streams.getVideoTracks()[0];
  var sender = pc.getSenders().find(function(s) {   // pc refers to => session.sessionDescriptionHandler.peerConnection;
    return s.track.kind == videoTrack.kind;
  }); 
  console.log('found sender:', sender);
  sender.replaceTrack(videoTrack);
}, function(error){
  console.log("error ", error);
});

to stop screen share again coming back to old video:
var option = {video: true, audio: true};
navigator.mediaDevices.getUserMedia(option)
.then(function(streams){
  var videoTrack = streams.getVideoTracks()[0];
  var sender = pc.getSenders().find(function(s) {  // pc refers to => session.sessionDescriptionHandler.peerConnection;
    return s.track.kind == videoTrack.kind;
  }); 
  console.log('found sender:', sender);
  sender.replaceTrack(videoTrack);
}, function(error){
  console.log("error ", error);
}); 

Thanks

okai...@gmail.com

unread,
Oct 10, 2019, 5:28:25 PM10/10/19
to SIP.js
OMG , your the savior of my life 
word really can't describe how i'm so thankful
Really from all my heart i thank you .

i also saw the same response on the other post , but the name is different , but i suppose its also you.

so by all meanings , THANK YOU SO MUCH

Hope you will have the best thing u dream about very soon.
Reply all
Reply to author
Forward
0 new messages