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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With