Availability: Android SDK v1.9.8+
The EnxRtc.clientBitrate() method provides bitrate status of the Client. It carries out the following tests to generate a response:
- Bandwidth
- Video bandwidth with TURN server
- Audio bandwidth with TURN Server
You can also build a UI to initiate the tests and generate a diagnostic report using this API.
Class: EnxRtc
Observer: public void setEnxClientBitrateObserver( EnxClientBitrateObserver-Object )
Method: public void clientBitrate(JSONObject clientInfo)
Parameters:
ClientInfo– Optional. JSON object with Client preferences for the execution of test cases.region:String. Region Id of ICE Server, e.g."IN", "SG", "US", "DE".Default Region ID is “DE”.
Callbacks:
onClientBitrateFinished– Notification sent when the API has completed the execution of the test case. This returns a JSON Object as the final result.onClientBitrateStatus– Notification sent with the test results at the beginning and end of the test. This returns a JSON Object as the test result.onClientBitrateFailed– Notification sent when the test fails.
Request for diagnostics:
setEnxClientBitrateObserver( EnxClientBitrateObserver-Object );
var clientInfo = {
region: 'IN'
};
EnxRtc.clientBitrate(clientInfo);
// Called when test fails
public void onClientBitrateStatus(JSONObject jsonObject) {
// JSON brings in error information
}
// Called when test starts and ends
public void onClientBitrateStatus (JSONObject jsonObject) {
// JSON structure explained later in the document
}
// Called when test finishes
public void onClientBitrateFinished(JSONObject jsonObject) {
// JSON structure explained later in the document
}
Response at the beginning and end of Test: onClientBitrateStatus
//Status at the start of test
{
"status": "started",
"test_case": "video_bandwidth",
"test_group": "bandwidth",
"test_region": "IN",
"test_server": "TURN"
}
// Status at the end of test
{
"test_group": "bandwidth",
"test_case": "video_bandwidth",
"status": "finished",
"output": {
"video_bandwidth": {
"result": "success",
"bandwidth_bps": 2221949,
"packets_lost_percentage": "0.99",
"execution_time": "31566 ms",
"success": [],
"error": [],
"warning": [],
"info": [],
"server": {
"region": "IN",
"url": "turns:ts.enablex.io:443"
}
}
},
"test_region": "IN",
"test_server": "TURN"
}
Final Response: onClientBitrateFinished
{
"video": {
"bitrate_bps": 2221949,
"connection": "stable"
},
"audio": {
"bitrate_bps": 278067,
"connection": "stable"
}
}
Test Result Explanation:
| Test Group | Test Case | Server | Result | Message |
|---|---|---|---|---|
| Bandwidth | Video Bandwidth | TURN | Success | Video resolution: Width x Height |
| Failure | Camera failure: Width x Height. Cannot test bandwidth without a working camera | |||
| Subject to quality | Average Video bandwidth <value> | |||
| Subject to quality | Packets lost: <value> | |||
| Subject to quality | RTT Average: <value> | |||
| Failure | getUserMedia() failed with error <error> | |||
| Failure | Frame Rate mean is 0, cannot test bandwidth without a working camera | |||
| Failure | Only Firefox and Chrome getStats() implementations are supported | |||
| Audio Bandwidth | TURN | Subject to quality | Average Audio bandwidth <value> | |
| Subject to quality | Packets lost: <value> | |||
| Subject to quality | RTT Average: <value> | |||
| Failure | getUserMedia() failed with error <error> | |||
| Failure | Only Firefox and Chrome getStats() implementations are supported |
Note: Currently this API is not working for Firefox and safari browser.
