web端视频通话能够获取对方网络信息吗?


#1

API提供的方法:


,但是获取到的都是undefined:
image
实现能够看到对方的网络信息


#2

可以获取
bitrate

154024

bitrateByLayer

{ “0.0”: 57608, “0.1”: 33312, “0.2”: 63104 }

byteCount

786409

firCount

0

fractionLost

0

jitter

6

kind

“video”

mimeType

“video/VP8”

nackCount

3

nackPacketCount

3

packetCount

1308

packetsDiscarded

0

packetsLost

4294967295

packetsRepaired

2

packetsRetransmitted

4

pliCount

1

rtxSsrc

3432000877

score

10

ssrc

1480356626

timestamp

7020621927

type

“inbound-rtp”

bitrate

508944

bitrateByLayer

{ “0.0”: 190168, “0.1”: 108592, “0.2”: 210184 }

byteCount

2686753

firCount

0

fractionLost

0

jitter

0

kind

“video”

mimeType

“video/VP8”

nackCount

153

nackPacketCount

161

packetCount

2797

packetsDiscarded

0

packetsLost

2

packetsRepaired

0

packetsRetransmitted

476

pliCount

1

rtxSsrc

3432000878

score

10

ssrc

1480356627

timestamp

7020621927

type

“inbound-rtp”


#3

纯网络信息各家浏览器也都有实现,比如mozilla:

var networks = navigator.mozNetworkStats.getAvailableNetworks();

networks.onsuccess = function() {
  var network = this.result[0]; // 0 for Wifi; returns a mozNetworkInterface object

  var end = new Date();
  var start = new Date();

  var samples = navigator.mozNetworkStats.getSamples(network, start, end); // returns a mozNetworkStats object

  samples.onsuccess = function () {
    console.log("Data received: " + samples.result.data[0].rxBytes + " Bytes");
    console.log("Data sent: " + samples.result.data[0].txBytes + " Bytes");
  };

  samples.onerror = function () {
    console.log("Something went wrong: ", samples.error);
  };
};

networks.onerror = function () {
  console.log("Something went wrong: ", networks.error);
};

#4

你那个要改,可以参考w3c的接口文档:
RTCInboundRtpStreamStats RTCReceivedRtpStreamStats