I'm trying to get stats of a webRTC app to measure audio/video streaming bandwidth. I checked this question and I found it very useful; however, when I try to use it I get
TypeError: Not enough arguments to RTCPeerConnection.getStats.
I think that is because of in 2016 something in webRTC is changed and now there are mediaStreamTracks; however I built the project without mediaStreamTracks and I don't know how to change this function to get it to work.
Do you have any ideas? Thanks for your support!
UPDATE:
My call is
peer.pc.onaddstream = function(event) {
peer.remoteVideoEl.setAttribute("id", event.stream.id);
attachMediaStream(peer.remoteVideoEl, event.stream);
remoteVideosContainer.appendChild(peer.remoteVideoEl);
getStats(peer.pc);
};
and getStats() is identical to this link at chapter n.7.
I'm trying to get stats of a webRTC app to measure audio/video streaming bandwidth. I checked this question and I found it very useful; however, when I try to use it I get
TypeError: Not enough arguments to RTCPeerConnection.getStats.
I think that is because of in 2016 something in webRTC is changed and now there are mediaStreamTracks; however I built the project without mediaStreamTracks and I don't know how to change this function to get it to work.
Do you have any ideas? Thanks for your support!
UPDATE:
My call is
peer.pc.onaddstream = function(event) {
peer.remoteVideoEl.setAttribute("id", event.stream.id);
attachMediaStream(peer.remoteVideoEl, event.stream);
remoteVideosContainer.appendChild(peer.remoteVideoEl);
getStats(peer.pc);
};
and getStats() is identical to this link at chapter n.7.
Share Improve this question edited May 23, 2017 at 12:00 CommunityBot 11 silver badge asked Jul 8, 2016 at 9:19 Don DiegoDon Diego 1,5083 gold badges26 silver badges55 bronze badges 6-
Post some code. Especially your call of
getStats()
– KRONWALLED Commented Jul 8, 2016 at 9:53 -
2
getStats()
needs amediaStreamTrack
as parameter, if i recall. – Samuel Méndez Commented Jul 8, 2016 at 9:59 -
Updated question! P.s: what if I call
peer.getStats(null, function(...) )
? – Don Diego Commented Jul 8, 2016 at 10:16 -
1
That should. The track is only a filter, and can be left out with
null
. – jib Commented Jul 8, 2016 at 13:18 - I would close this as a duplicate of this question, except you seem to want it to work in Chrome specifically, is that right? – jib Commented Jul 8, 2016 at 13:19
1 Answer
Reset to default 6been sometime since I used WebRTC, problem then was, chrome and firefox implemented it differently( believe they still do it differently)
Firefox:
webrtc stats tab is about:webrtc
peerConnection.getStats(null).then(function(stats){... // returns a promise
Chrome:
webrtc stats tab is chrome://webrtc-internals/
peerConnection.getStats(function(stats){ // pass a callback function
one way to circumvent these cross browser issues is using adapter.js