Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get stream object from kurento utils when using kurento java tutorial samples

Tags:

webrtc

kurento

Using kurento tutorials java samples. I Want to handle stream events like onended etc on the webrtcpeer object. Following is my sample code from where i want to fetch the stream object.

var options = {
           localVideo: video,
           mediaConstraints: constraints,
           onicecandidate: participant.onIceCandidate.bind(participant)
       };

var peer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options, function(error) {
           if (error) {
               return console.error(error);
           }
           this.generateOffer(participant.offerToReceiveVideo.bind(participant));
       });

I want to handle events in a way similar to as mentions in this question

How should I proceed? Please Help

like image 994
Akshay Kasar Avatar asked Nov 28 '25 14:11

Akshay Kasar


1 Answers

You can bind to those events two ways

  • Passing a onstreamended listener in the options bag

    var options = {
           localVideo: video,
           mediaConstraints: constraints,
           onicecandidate: participant.onIceCandidate.bind(participant),
           onstreamended: myOnStreamEnded,
       };
    
  • Accessing directly the RTCPeerConnection object wrapped inside the WebRtcPeer, and binding to events directly.

    var rtcPeerConnection = peer.peerConnection
    

The latter gives you full access to the peer connection object, so you can work as if you would with that object.

like image 85
igracia Avatar answered Dec 02 '25 05:12

igracia