I'm trying to build a simple webrtc video chat application. I went through the webrtc API's overview and documentation. I used the sample chat application code example given here
and the github url is https://github.com/webrtc/FirebaseRTC/tree/solution. But now, I want to add additional features in this, like displaying latency of the video chat. What are the ways to do that. I tried to log the latency property of MediaTrackConstraints but it gave me undefined.
peerConnection.addEventListener('track', event => {
console.log('Got remote track:', event.streams[0]);
event.streams[0].getTracks().forEach(track => {
console.log('Add a track to the remoteStream:', track);
remoteStream.addTrack(track);
console.log('Track settings are:', track.getConstraints().latency);<------- here, it logs undefined
});
});
Is this the right way to get latency or there is another way to do it. Is there a timestamp based method? And in documentation it says that the latency property is only available for audio stream, so what do I do for video stream. I am a beginner in this. Any help is appreciated, Thanks.