A library for getting a user's network, software, and hardware diagnostics. This library provides the same data used on the TokBox user diagnostic page (http://tokbox.com/user-diagnostic). Using it you will be able to get data like the following:
{
"cat_software": {
"flash_version": {
"Flash Version": {
"reason": "v11.5",
"result": "Pass"
}
},
"local_shared_object": {
"Local Shared Object": {
"reason": "Can write to local storage",
"result": "Pass"
}
},
"user_agent": {
"User Agent": {
"reason": "Chrome 23",
"result": "Pass"
}
},
"operating_system": {
"Operating System": {
"reason": "Mac OS 10.7.5",
"result": "Pass"
}
}
},
"cat_hardware": {
"camera_count": {
"count": {
"reason": "Detected 1 camera",
"result": "Pass"
}
},
"microphone_count": {
"Count": {
"reason": "Detected 2 microphones",
"result": "Pass"
}
}
},
"cat_network": {
"uri_access": {
"http://static.opentok.com": {
"reason": "Connected Successfully",
"result": "Pass"
},
"http://hlg.tokbox.com": {
"reason": "Connected Successfully",
"result": "Pass"
},
"http://api.opentok.com": {
"reason": "Connected Successfully",
"result": "Pass"
}
},
"port_access": {
"1935": {
"reason": "Connection established",
"result": "Pass"
}
}
}
}Include TB.diagnostic.min.js on your page:
<script type="text/javascript" src="TB.diagnostic.min.js"></script>The library exposes one method TB.runTests(callback). Use it like this:
TB.runTests(function(data) {
// Do something with data...
alert("finished running the test!")
console.log(data);
if (data.cat_network.port_access["1935"].result == "Fail") {
alert("Port 1935 is closed!");
}
if (data.cat_hardware.camera_count.count.result == "Fail") {
alert("No webcams were found");
}
})The call to TB.runTests can take about 10-20 seconds to run.