Availability: Android SDK v1.9.6+

The EnxRtc.clientDiagnostics() method acts as a Diagnostic Tool to detect any issue causing the RTC to fail. The API runs through predefined test cases related to WebRTC issues and reports asynchronously through an Event as it passes through each test. These test cases are organized in “Test Groups” as shown below:

  • Microphone
    • Audio capture.
  • Camera
    • Check resolution 320×240.
    • Check resolution 640×480.
    • Check resolution 1280×720.
    • Check supported resolutions.
  • Network
    • UDP enabled with TURN server.
    • TCP enabled with TURN server.
    • IPv6 enabled with TURN server.
    • UDP enabled with STUN server.
    • TCP enabled with STUN server.
    • IPv6 enabled with STUN server.
  • Connectivity
    • Relay connectivity with TURN server.
    • Reflexive connectivity with TURN server.
    • Host connectivity with TURN server.
    • Reflexive connectivity with STUN server.
    • Host connectivity with STUN server.
  • Throughput
    • Data throughput with TURN server.
  • Bandwidth
    • Video bandwidth with TURN server.
    • Audio bandwidth with TURN Server.
  • Signaling
    • Signaling connectivity 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 setEnxTroubleShooterObserver(EnxTroubleShooterObserver-Object)

Method: public void clientDiagnostics(JSONObject Options)

Parameters:

  • Options – JSON object with Client preferences for the execution of Test cases. JSON Keys are explained below:
    • testNames: Array of Test Group names. e.g. [ "microphone", "camera", "network", "connectivity", "throughput", "bandwidth", "signalling"]
      • To test only selected Test Groups, add selected Test Group names e.g., ["microphone", "camera"].
      • To test all the Test Groups, use ["all"].
    • audioDeviceId: Optional. Device Id of input audio device.
    • videoDeviceId: Optional. Device Id of input video device.
    • regionId: Optional. Array of region Ids of ICE Servers, e.g. ["IN", "SG", "US", "DE"]. Get Region-ID list from Portal
    • testDurationDataThroughput: Optional. Test duration of data throughput in seconds. [Range: 1-30 sec. Default: 2 sec]
    • testDurationVideoBandwidth: Optional. Test duration of video bandwidth in seconds. [Range: 1-30 sec. Default: 10 sec]
    • testDurationAudioBandwidth: Optional. Test duration of audio bandwidth in seconds. [Range: 1-30 sec. Default: 10 sec]
    • stop: Optional. Boolean. Set to true to stop the test cases which are already in execution.

Callbacks:

  • onClientDiagnosisFailed – Notification of Diagnosis failure when API is called with the wrong parameter or a repeated attempt to call the API is made while the previous request is under process.
  • onClientDiagnosisStopped – Notification sent when the API execution is stopped explicitly through Method Call.
  • onClientDiagnosisFinished – Notification sent when the API completes execution of all the test cases. This returns a JSON Object with a complete test result of all the test cases.
  • onClientDiagnosisStatus – Notification sent with the test result of each test case as the API passes through the execution of each test till the completion or till stopped explicitly. This returns a JSON Object with test results.

Request for diagnostics:

Options = {
     testNames: ['microphone', 'camera'],
     audioDeviceId: 'XXX',
     videoDeviceId: 'XXX',
     regionId: ['IN'],
     testDurationDataThroughput: 2,
     testDurationVideoBandwidth: 30,
     testDurationAudioBandwidth: 30,
     stop: false
};

enxRtc.clientDiagnostics(Options);	// Execute Test


// Test Execution finished
public void onClientDiagnosisStatus(JSONObject jsonObject) {
	// Handle JSON from jsonObject.
	// It contains complete test result. A response example given later
});

// Test Execution has failed
public void onClientDiagnosisFailed(String msg) {
	// Handle error message from msg
	// Response example:
	/* 
	- Invalid argument.
	- Diagnosis is already in progress. Few resources are in use and may not be accessible.
	*/
});

// Test Execution has stopped
public void onClientDiagnosisStopped(String msg) {
	// Handle info message from msg
	// Response example:
	/* 
	- Diagnosis stopped.
	- Diagnosis not running.
	*/
});

// Intermediate Test Result of each  Test Case 
public void onClientDiagnosisFinished(JSONObject jsonObject) {
	// Handle JSON in jsonObject
	// It contains complete test result. A response example given later
});

Response at the beginning of the Test: onClientDiagnosisStatus

{
  "test_group": "microphone",
  "test_case": "audio_capture",
  "status": "started",
  "output": ""
}

Intermediate Response after finishing a test case: onClientDiagnosisStatus

{
"test_group": "microphone",
"test_case": "audio_capture",
"status": "finished",
"output": {
"audio_capture": {
"result": "success",
"execution_time": "241 ms",
"success": [
{
"message": "Audio track created using device=Default - Microphone Array (Synaptics Audio)"
},
{
"message": "Active audio input channels: 2"
}
],
"error": [],
"warning": [],
"info": [
{
"message": "Channel 0 levels: -38.3 dB (peak), -48.4 dB (RMS)"
},
{
"message": "Channel 1 levels: -38.3 dB (peak), -48.4 dB (RMS)"
},
{
"message": "Stereo microphone detected."
}
]
}
}
}

Final Response after completion of all the test cases: onClientDiagnosisFinished

{
"microphone": {
"audio_capture": {
"result": "success",
"execution_time": "241 ms",
"success": [
{
"message": "Audio track created using device=Default - Microphone Array (Synaptics Audio)"
},
{
"message": "Active audio input channels: 2"
}
],
"error": [],
"warning": []
}
},
"network": {
"udp_enabled": {
"IN": {
"TURN": {
"result": "success",
"execution_time": "241 ms",
"success": [
{
"message": "Gathered candidate of Type: relay Protocol: udp Address: 104.211.155.197"
}
],
"error": [],
"warning": [],
"server": {
"region": "IN",
"url": "turns:ts.enablex.io:443"
}
}
}
},
"tcp_enabled": {
"IN": {
"TURN": {
"result": "success",
"execution_time": "241 ms",
"success": [
{
"message": "Gathered candidate of Type: relay Protocol: udp Address: 104.211.155.197"
}
],
"error": [],
"warning": [],
"server": {
"region": "IN",
"url": "turns:ts.enablex.io:443"
}
}
}
}
}
}

Test Results Explained:

Test GroupTest CaseServerResultMessage
MicrophoneAudio CaptureN/ASuccessAudio track created using device #device#
SuccessActive audio input channels #channel#
FailureWebAudio run failure:
FailureNo audio track in returned stream
FailureNo active input channels detected
FailureNo active input channels detected. Microphone is most likely muted or broken, please check if muted in the sound settings or physically on the device. Then re-run the test.
FailureMicrophone input level is low, increase input volume or move closer to the microphone.
FailuregetUserMedia failed with error #error#
Cameracheck resolution 240N/ASuccessCaptured video using expected resolution
SuccessAverage FPS above threshold
FailuregetUserMedia failed with error #error#
FailureNo video track in returned stream
FailureVideo track ended, camera stopped working
FailureLow average sent FPS
FailureIncorrect captured resolution
FailureCould not analyze any video frame
FailureCamera delivering lots of black frames
FailureCamera delivering lots of frozen frames
Cameracheck resolution 480SuccessCaptured video using expected resolution
SuccessAverage FPS above threshold
FailuregetUserMedia failed with error #error#
FailureNo video track in returned stream
FailureVideo track ended, camera stopped working
FailureLow average sent FPS
FailureIncorrect captured resolution
FailureCould not analyze any video frame
FailureCamera delivering lots of black frames
FailureCamera delivering lots of frozen frames
Cameracheck resolution 720SuccessCaptured video using expected resolution
SuccessAverage FPS above threshold
FailuregetUserMedia failed with error #error#
FailureNo video track in returned stream
FailureVideo track ended, camera stopped working
FailureLow average sent FPS
FaiiureIncorrect captured resolution
FailureCould not analyze any video frame
FailureCamera delivering lots of black frames
FailureCamera delivering lots of frozen frames
Cameracheck supported resolutionsN/ASuccessSuccess Supported resolution #resolution#
FailureNo video track in returned stream
FailureVideo track ended, camera stopped working
Networkudp enabledTURNSuccessSupported resolution #resolution#
FailureNo video track in returned stream
FailureVideo track ended, camera stopped working
Networkudp enabledSTUNSuccessGathered candidate of Type: relay Protocol: udp Address: #IP#
FailureFailed to gather specified candidates
FailureFailed to create peer connection: #<error#
Networktcp enabledTURNSucessGathered candidate of Type: relay Protocol: udp Address: #IP#
FailureFailed to gather specified candidates
FailureFailed to create peer connection: #<error#
Networktcp enabledSTUNSuccessGathered candidate of Type: relay Protocol: udp Address: #IP#
FailureFailed to gather specified candidates
FailureFailed to create peer connection: #<error#
Networkipv6 enabledTURNSuccessGathered candidate of Type: relay Protocol: udp Address: #IP#
FailureFailed to gather IPv6 candidates, it might not be setup/supported on the network
FailureFailed to gather IPv6 candidates, it might not be setup/supported on the network
Networkipv6 enabledSTUNSuccessGathered candidate of Type: relay Protocol: udp Address: #IP#
FailureFailed to gather IPv6 candidates, it might not be setup/supported on the network
FailureFailed to gather IPv6 candidates, it might not be setup/supported on the network
Connectivityrelay connectivityTURNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
Connectivityrelay connectivitySTUNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
Connectivityreflexive connectivityTURNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
Connectivityreflexive connectivitySTUNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
Connectivityhost connectivityTURNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
Connectivityhost connectivitySTUNSuccessData successfully transmitted between peers
FailureInvalid data transmitted
FailureTime out
ThroughputData ThroughputTURNSuccessTotal transmitted: #n# kilo-bits in #t# seconds
FailureTimed out
BandwidthVideo BandwidthTURNSuccessVideo resolution: #Width# x #Height#
FailureCamera failure: #Width# x #Height#. Cannot test bandwidth without a working camera
FailuregetUserMedia failed with error #error#
FailureFrame rate mean is 0, cannot test bandwidth without a working camera
FailureCould not gather stats
FailureOnly Firefox and Chrome getStats implementations are supported
BandwidthAudio BandwidthTURNSubject to qualityAverage Audio bandwidth <value>
Subject to qualityPackets lost: <value>
Subject to qualityRTT Average: <value>
FailuregetUserMedia() failed with error <error>
FailureOnly Firefox and Chrome getStats() implementations are supported
SignalingSignaling ConnectivitySuccessToken created successfully
FailureToken creation failed due to error: #error#
FailureRoom not joined due to error: #error#
SuccessRoom joined successfully