问题描述
我想访问 chrome:// webrtc-internals /
中的一些记录变量,但我没有在google上找到任何东西 - 甚至没有我可以看到这些图的描述。
我特别感兴趣的是 packetsLost
, googCurrentDelayMs
和 googNacksSent
。
为什么我要访问webrtc内部
我正在写一个 google chrome应用程序共享视频流(p2p)。它使用与其他同行共享流,然后使用Google强制实施 webrtc 实施下。为了使我的应用程序更加完美,我需要知道什么时候会发生很大的延迟。由于我可以看到记录在 chrome:// webrtc-internals /
中的延迟,我想知道是否可以通过javascript访问它。
我的猜测是没有API用于 chrome:// webrtc-internals /
-menu。
我发现它 - 必须通过几个Google社区线程(,):
var peerjs = new Peer(...); //初始化peerJS
var connections = peerjs.connections;
连接是一个对象:
<$ p $对象{2e1c5694-e6ef-e1b2-22d5-84a3807961d4:数组[3]}
2e1c5694-e6ef-e1b2-22d5-84a3807961d4:数组[3]
0:DataConnection
1:MediaConnection
2:MediaConnection
length:3
__proto__:Array [0]
__proto__:Object
查看任何这些连接对象:
var rtcPeerConn = connectionObject.pc; // RTCPeerConnection
rtcPeerConn.getStats(函数回调(connStats){
var rtcStatsReports = connStats.result()//可用状态报告数组
// each status-报表对象有很多状态变量,比如
// googCurrentDelayMs。你需要迭代所有对象并检查
//他们的名字以找到你想要的状态报告
rtcStatsReports [7] .names()//返回该报表的所有可用变量
var googCurrentDelayMs = rtcStatsReports [7] .stat('googCurrentDelayMs')
console.log(googCurrentDelayMs)// finally - googCurrentDelayMs :-)
})
I want to get access to some of the logged variables in the chrome://webrtc-internals/
, but I didn't find anything on google - not even a description of the graphs I can see.
I am particularly interested in packetsLost
, googCurrentDelayMs
and googNacksSent
.
why I want to access the webrtc-internals
I am writing a google chrome application that shares a video stream (p2p). It uses peerjs to share the stream with other peers, which in turn uses googles webrtc implementation underneath. To make my application perfect I would need to know when a big delay occurs. Since I can see the delay logged in chrome://webrtc-internals/
I was wondering if I could access it through javascript.
My guess is there is no API for the chrome://webrtc-internals/
-menu.
I found it - had to crawl through a couple of google community-threads(thread 1, thread2):
var peerjs = new Peer(...); // initialize peerJS
var connections = peerjs.connections;
Connections is an object:
Object {2e1c5694-e6ef-e1b2-22d5-84a3807961d4: Array[3]}
2e1c5694-e6ef-e1b2-22d5-84a3807961d4: Array[3]
0: DataConnection
1: MediaConnection
2: MediaConnection
length: 3
__proto__: Array[0]
__proto__: Object
Take a look at any of those connection objects:
var rtcPeerConn = connectionObject.pc; // RTCPeerConnection
rtcPeerConn.getStats(function callback(connStats){
var rtcStatsReports = connStats.result() // array of available status-reports
// each status-report object has many status variables, such as
// googCurrentDelayMs. You need to iterate over all object and check
// their names to find the one status report you want
rtcStatsReports[7].names() // returns all available variables for that report
var googCurrentDelayMs = rtcStatsReports[7].stat('googCurrentDelayMs')
console.log(googCurrentDelayMs) // finally - googCurrentDelayMs :-)
})
这篇关于在javascript中是否有一个用于chrome:// webrtc-internals / variables的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!