javascript - What is the current bandwidth or quality of an audio MediaStream in a browser? (WebRTC) -
i'm building webrtc application , want gather statistics in order rate solution. 1 metric i'm interested in current bandwidth of received audio (and video) stream. able find used codec @ chrome://webrtc-internals/
(opus), wasn't able find numbers current quality/bandwidth of stream (e.g. 128kbit/s).
i searched rtcpeerconnection object such numbers, haven't found some. xxx.rtcconnection.getremotestreams()[0].getaudiotracks()[0].getconstraints()
returns
{ deviceid: {}, echocancellation: {}, facingmode: {}, framerate: {}, height: {}, mediasource: "camera", mozautogaincontrol: {}, moznoisesuppression: {}, viewportheight: {}, viewportoffsetx: {}, ... }
that contains information video stream (funnily requested audio stream) , no bandwidth details. there no other streams arrays in example above. know need current quality/bandwidth of mediastream?
you need use rtcpeerconnection.getstats() api, search bytesreceived , calculate bitrate difference of bytesreceived between 2 calls. this shows complete example.
Comments
Post a Comment