Utilities
The Android SDK provides the following methods for managing different aspects of video sessions:
- adjustLayout(): To adjust the video player layout to fit within its parent view.
- clientBitrate(): To provide a bitrate status of the client.
- makeOutboundCall(): To initiate an outbound call to a PSTN number or a SIP URI while being in a session.
- makeOutboundCalls(): To initiate an outbound call to a PSTN numbers (maximum 5 numbers).
- cancelOutboundCall(): To cancel an ongoing outbound call to a PSTN number or SIP URI.
- setAudioOnlyMode(): To switch to an audio-only call.
- clientDiagnostics(): To detect any issue causing the RTC to fail.
- updateConfiguration(): To reconfigure a stream by adding new or updating existing attributes of the stream.
- stopVideoTracksOnApplicationBackground(): To switch the RTC application to the background.
- startVideoTracksOnApplicationForeground(): To switch the RTC application to the foreground.
- enableProximitySensor(): To detect the proximity.
- captureScreenShot(): To take snapshot of a video stream in your application.
- enableLogs(): To enable console logging.
- postClientLogs(): To share console log with EnableX tech team for audit.
Adjust Layout
You can play the remote streams in the Active Talker list with a custom-defined view by selecting activeviews : view
during connect()
. You do not need to handle the UI in this case, as the predefined video grid plays all the streams received at the client endpoint. When choosing this option, you can use the adjustLayout()
method to adjust the video player layout to fit within its parent view. This method helps when a user rotates the screen or when the view needs to be adjusted to fit correctly.
Class: EnxRoom
Method: public void adjustLayout(int frameWidth, int frameHeight)
Parameters | Data Type | Description |
---|---|---|
frameWidth |
Numeric | Width of framed view. |
frameHeight |
Numeric | Height of framed view. |
Sample Code
enxRoom.adjustLayout(width,height)
Bitrate Status of Client
This fucntionality is available from Adroid SDK 1.9.8 and later versions.
The EnxRtc.clientBitrate()
method provides the bitrate status of the client. It carries out the following tests to generate a response:
Bandwidth:
- Video bandwidth with the TURN server.
- Audio bandwidth with the TURN Server.
Class: EnxRtc
Observer: public void setEnxClientBitrateObserver( EnxClientBitrateObserver-Object )
Method: public void clientBitrate(JSONObject clientInfo)
Parameter: ClientInfo
: Optional. JSON object with Client preferences for the execution of test cases. ClientInfo.region
: String. Region Id of the ICE server. For example, "IN", "SG", "US", "DE"
The default Region ID is "DE".
Callbacks
Callback | Description |
---|---|
onClientBitrateFinished | Not Applicable |
onClientBitrateStatus | Not Applicable |
onClientBitrateFailed | Not Applicable |
Sample Code
- Request for diagnostics:
setEnxClientBitrateObserver( EnxClientBitrateObserver-Object );var clientInfo = {region: 'IN'};EnxRtc.clientBitrate(clientInfo);// Called when test failspublic void onClientBitrateStatus(JSONObject jsonObject) {// JSON brings in error information}// Called when test starts and endspublic void onClientBitrateStatus (JSONObject jsonObject) {// JSON structure explained later in the document}// Called when test finishespublic 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. | |||
Failure | Frame Rate mean is 0, cannot test bandwidth without a working camera. | |||
Failure | Only Firefox and Chrome getStats() implementations are supported. | |||
Auto 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. | |||
Failure | Only Firefox and Chrome getStats() implementations are supported. |
Note: Currently, this API is not working for Firefox and safari browser.
Dialing Out to Phone and SIP Endpoint from a Video Room
Dial Out
The EnxRoom.makeOutboundCall()
method initiates an outbound call to a PSTN number or SIP URI while in the session, thus inviting the called participant to join the session on accepting the call.
Class: EnxRoom
Methods:
public void makeOutboundCall(String dialout_number, String cli_number, JSONObject dialOptions)
: To dial a single phone number.public void makeOutboundCalls(List<String> numberList, String cli_number, JSONObject dialOptions)
: To dial multiple phone numbers (a maximum of 5 phone numbers can be dialed).
Parameters
Parameter | Key | Data Type | Description |
---|---|---|---|
dialout_number |
Not Applicable | String | It can be either a PSTN number or a SIP URI to dial out. |
numberList |
Not Applicable | List of Strings | Multiple PSTN or SIP URL to dial out. |
cli_number |
Not Applicable | String | Calling line identification number to be added as the originator of the call. In the case of a PSTN phone number, the number is validated against your purchased number or the opted shared number. If the CLI does not match, the call fails with the "CLI mismatch" error. |
options |
options.name |
String | Name of the dialed participant. If the name is omitted, the dialed phone number is used as the name. |
options.early_media |
Boolean | The default value is false. Set it to true, if the ringer is played in the room when the dial-out is initiated. Set it to false if the ringer is not placed in the room when the dial-out is in progress. | |
options.silent_join |
Boolean | The default value is true. Set it to true if the dialed participant is not admitted to the room until the participant answers the call. Set it to false if the dialed participant is admitted to the room as soon as the dial-out is in progress and ringer is played. |
Note:
early_media
andsilent_join
may not be used together.
Callbacks
Callback | Description |
---|---|
onDialStateEvents | Notifying the call initiator about the status of the dial-out process as received from gateway. The JSON response returns status codes as initiated, calling, connecting, connected, and terminated. |
onDTMFCollected | Notification when DTMF input is collected. It gets the string of digits collected. |
Note: The <options>
parameter is available only in Android SDK 2.1.3 and later versions.
Sample Code
room.makeOutbound('00999999999', '00999999999' dialOptions);Public void onDialStateEvents(JSONObject jsonobject){// event JSON contains status of dial-out process/*{ number: "9999999999", /* Dialed Phone Number of SIP URI */status: "connected", /* Status of dialout Process */description: "Detailed description"}status may be initiated, calling, connecting,connected & terminated*/}Public void onDTMFCollected(String DTMFInput){// DTMFINput - A String of digits collected through DTMF}
Error Codes and Exceptions
Code | Description |
---|---|
1141 | Dial out request already in process. |
1142 | CLI does not match with the configured phone number. |
5095 | Invalid phone number. |
Cancel an Outbound Call
This functionality is available only in Android SDK 2.1.3 and later versions.
The EnxRoom.cancelOutboundCall()
method allows you to cancel an ongoing outbound call to a PSTN number or SIP URI thus disconnects the participant from the session on passing the number.
Class: EnxRoom
Method: public void cancelOutboundCall(String number)
Parameter: number
: String. A PSTN number or a SIP URI to disconnect from the session.
Delegate Method: onOutBoundCallCancel
: Notification to the call initiator when the participant gets disconnected.
Sample Code
enxRoom cancelOutboundCall('9999999999'); // Cancel a Callpublic void onOutBoundCallCancel(JSONObject jsonObject);{// Acknowledge that the Call has been cancelled{ number: "9999999999", /* Phone Number of SIP URI */}}
Send DTMF Response
This functionality is available from iOS SDK v2.3.16+ onwards.
The EnxRoom.sendDTMF()
method allows send DTMF response to pass through an IVR if dialed out PSTN Call is connected to IVR. This method can be executed repeatedly to pass single digit or multiple digits in a single call.
An outbound PSTN Call must have been answered first to make use of sendDTMF()
method to pass DTMF digits on the same PSTN channel.
- Method:
public void sendDTMF(String number, String digits)
- Parameters:
options
:number
: String. It's the samenumber
used withmakeOutboundCall()
method. It can be either a PSTN Number or a SIP URI to dial out. For Phone Number, use country code without 00 or +.digits
: String. Digit(s) to pass on to Voice Service as DTMF digits.
- Callbacks:
onOutBoundCallSendDtmf
: Method call success and failure notifications are given with error codes.
Sample Code
enxRoom.sendDTMF("919999988888", "1"); // Send DTMF 1Public void onOutBoundCallSendDtmf(JSONObject jsonobject){// event JSON contains status of sendDTMF}
Error Codes
Code | Description |
---|---|
1155 | Invalid options/parameters/values. |
1201 | Invalid Dial-State. |
1202 | Outbound Dial Request not found. |
Audio Only Mode for Video Room
The EnxRoom.setAudioOnlyMode()
method allows you to switch to an audio-only call where you can neither receive anybody's video nor publish your video. You can use this method as a toggle to switch between audio-only and audio-video calls. It does not affect video streams of others in the room.
Class: EnxRoom
Method: publish void setAudioOnlyMode( boolean AudioOnly)
Parameter: AudioOnly
: Boolean. Set it to true to switch to an audio-only call.
Set it to false to switch to an audio-video call.
Sample Code
room.setAudioOnlyMode(true); // Switch to Audio-Only callroom.setAudioOnlyMode(false); // Switch back to Audio-Video call
Error Codes and Exceptions
Code | Description |
---|---|
5051 | Repeated setAudioOnlyMode() is called when a previous audio-only request is in process. |
5052 | Repeated setAudioOnlyMode() is called when audio-only mode is already active. |
5053 | Repeated setAudioOnlyMode() is called when audio-video mode already active. |
5054 | Repeated setAudioOnlyMode() is called when a previous audio-video request is in process. |
Pre-Call Test
This functionality is available only in Android SDK 1.9.6 and later versions.
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:
Test Group | Type |
---|---|
Microphone | Audio capture. |
Camera | Check resolution 320×240. |
Check resolution 640×480. | |
Check resolution 1280×720. | |
Check supported resolutions. | |
Network | UDP enabled with the TURN server. |
TCP enabled with the TURN server. | |
IPv6 enabled with the TURN server. | |
UDP enabled with the STUN server. | |
TCP enabled with the STUN server. | |
IPv6 enabled with the STUN server. | |
Connectivity | Relay connectivity with the TURN server. |
Reflexive connectivity with the TURN server. | |
Host connectivity with the TURN server. | |
Reflexive connectivity with the TURN server. | |
Host connectivity with the TURN server. | |
Throughput | Data throughput with the TURN server. |
Bandwidth | Video bandwidth with the TURN server. |
Audio bandwidth with the TURN Server. | |
Signaling | Signaling connectivity with the TURN server. |
You can also build a UI using the following API to initiate the tests and generate a diagnostic report.
Class: EnxRtc
Observer: public void setEnxTroubleShooterObserver(EnxTroubleShooterObserver-Object)
Method: public void clientDiagnostics(JSONObject Options)
Parameters
Parameters | Keys | Data Type | Description |
---|---|---|---|
Options |
Options.testNames |
Array | Array of test group names. For example: [ "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"]. |
Options.audioDeviceId |
Number | Optional Device Id of the input audio device. | |
Options.videoDeviceId |
Number | Optional Device Id of the input video device. | |
Options.regionId |
Array | Optional Array of region Ids of ICE servers. For example: ["IN", "SG", "US", "DE"]. Get Region-ID list from Portal. | |
Options.testDurationDataThroughput |
Number | Optional Test duration of data throughput in seconds. Range: 1-30 sec. Default: 2 sec. | |
Options.testDurationVideoBandwidth |
Number | Optional Test duration of video throughput in seconds. Range: 1-30 sec. Default: 10 sec. | |
Options.testDurationAudioBandwidth |
Number | Optional Test duration of audio throughput in seconds. Range: 1-30 sec Default: 10 sec. | |
Options.stop |
Boolean | Optional Set it to true to stop the test cases which are already in execution. |
Callbacks
Callback | Description |
---|---|
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 is sent when the API completes the 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 result of each test case. The API passes through the execution till the completion or till stopped explicitly. |
Sample Code
Sample 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 finishedpublic void onClientDiagnosisStatus(JSONObject jsonObject) {// Handle JSON from jsonObject.// It contains complete test result. A response example given later});// Test Execution has failedpublic 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 stoppedpublic void onClientDiagnosisStopped(String msg) {// Handle info message from msg// Response example:/*- Diagnosis stopped.- Diagnosis not running.*/});// Intermediate Test Result of each Test Casepublic 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 Group | Test Case | Server | Result | Message |
---|---|---|---|---|
Microphone | Audio Capture | Not Applicable | Success | Audio track created using device. |
Success | Active audio input channels. | |||
Failure | WebAudio run failure. | |||
Failure | No audio track in returned stream. | |||
Failure | No active input channels detected. | |||
Failure | No 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. | |||
Failure | Microphone input level is low, increase input volume or move closer to the microphone. | |||
Failure | getUserMedia failed with error. | |||
Camera | check resolution 240 | Not Applicable | Success | Captured video using expected resolution. |
Success | Average FPS above threshold. | |||
Failure | getUserMedia failed with error. | |||
Failure | No video track in returned stream. | |||
Failure | Video track ended, camera stopped working. | |||
Failure | Low average sent FPS. | |||
Failure | Incorrect captured resolution. | |||
Failure | Could not analyze any video frame. | |||
Failure | Camera delivering lots of black frames. | |||
Failure | Camera delivering lots of frozen frames. | |||
Camera | check resolution 480 | Not Applicable | Success | Captured video using expected resolution. |
Success | Average FPS above threshold. | |||
Failure | getUserMedia failed with error. | |||
Failure | No video track in returned stream. | |||
Failure | Video track ended, camera stopped working. | |||
Failure | Low average sent FPS. | |||
Failure | Incorrect captured resolution. | |||
Failure | Could not analyze any video frame. | |||
Failure | Camera delivering lots of black frames. | |||
Failure | Camera delivering lots of frozen frames. | |||
Camera | check resolution 720 | Not Applicable | Success | Captured video using expected resolution. |
Success | Average FPS above threshold. | |||
Failure | getUserMedia failed with error. | |||
Failure | No video track in returned stream. | |||
Failure | Video track ended, camera stopped working. | |||
Failure | Low average sent FPS. | |||
Failure | Incorrect captured resolution. | |||
Failure | Could not analyze any video frame. | |||
Failure | Camera delivering lots of black frames. | |||
Failure | Camera delivering lots of frozen frames. | |||
Camera | check supported resolutions | Not Applicable | Success | Success Supported resolution. |
Failure | No video track in returned stream. | |||
Failure | Video track ended, camera stopped working. | |||
Network | udp enabled | TURN | Success | Success Supported resolution. |
Failure | No video track in returned stream. | |||
Failure | Video track ended, camera stopped working. | |||
Network | udp enabled | STUN | Success | Gathered candidate of Type: relay Protocol: udp Address: IP |
Failure | Failed to gather specified candidates | |||
Failure | Failed to create peer connection: error. | |||
Network | tcp enabled | TURN | Success | Gathered candidate of Type: relay protocol: udp Address: IP |
Failure | Failed to gather specified candidates. | |||
Failure | Failed to create peer connection: error. | |||
Network | tcp enabled | STUN | Success | Gathered candidate of Type: relay protocol: udp Address: IP |
Failure | Failed to gather specified candidates. | |||
Failure | Failed to create peer connection: error. | |||
Network | ipv6 enabled | TURN | Success | Gathered candidate of Type: relay protocol: udp Address: IP. |
Failure | Failed to gather IPv6 candidates, it might not be setup/supported on the network. | |||
Failure | Failed to gather IPv6 candidates, it might not be setup/supported on the network. | |||
Network | ipv6 enabled | STUN | Success | Gathered candidate of Type: relay protocol: udp Address: IP. |
Failure | Failed to gather IPv6 candidates, it might not be setup/supported on the network. | |||
Failure | Failed to gather IPv6 candidates, it might not be setup/supported on the network. | |||
Connectivity | relay connectivity | TURN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Connectivity | relay connectivity | STUN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Connectivity | reflexive connectivity | TURN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Connectivity | reflexive connectivity | STUN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Connectivity | host connectivity | TURN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Connectivity | host connectivity | STUN | Success | Data successfully transmitted between peers. |
Failure | Invalid data transmitted. | |||
Failure | Time out. | |||
Throughput | Data Throughput | TURN | Success | Total transmitted: n kilo-bits in t seconds. |
Failure | Timed out. | |||
Bandwidth | Video Bandwidth | TURN | Success | Video resolution: Width x Height. |
Failure | Camera failure: Width x Height. Cannot test bandwidth without a working camera. | |||
Failure | getUserMedia failed with error. | |||
Failure | Frame rate mean is 0, cannot test bandwidth without a working camera. | |||
Failure | Could not gather stats. | |||
Failure | Only Firefox and Chrome getStats implementations are supported. | |||
Bandwidth | 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. | |||
Failure | Only Firefox and Chrome getStats() implementations are supported. | |||
Signaling | Signaling Connectivity | Not Applicable | Success | Token created successfully. |
Failure | Token creation failed due to error. | |||
Failure | Room not joined due to error. | |||
Success | Room joined successfully. |
Updating Stream Configuration
This functionality is available in the Android SDK version 1.5.6 and later.
The EnxStream.updateConfiguration()
method is used to reconfigure a stream by adding new or updating existing attributes of the stream. This API applies to both remote and local streams.
Class: EnxStream
Method: public void updateConfiguration(JSONObject streamOpt)
Parameter: streamOpt
: JSONObject. New stream configuration options.
Sample Code
localStream.updateConfiguration(JSONObject streamOpt);// The streamOpt JSON Object example:streamOpt = {"maxVideoBW": "900","minVideoBW": "150","maxAudioBW": "150","minAudioBW": "150"};
Error Codes and Exceptions
Code | Description |
---|---|
5113 | Invalid JSON Object passed as parameter. |
5114 | Unable to update stream when canvas streaming is on. Non-Contextual method call. |
Handle Audio Device Updates
The notification on any addition or modification in the audio devices such as earphones or headphones connected to the mobile device is provided through the following Callbacks:
Callbacks:
Callback | Description |
---|---|
onNotifyDeviceUpdate | Acknowledgment to the user when a switch to alternate media devices is made at runtime. |
onDeviceAdded | Notification to the user when a new audio device is connected. |
onDeviceRemoved | Notification to the user when an audio device is disconnected. |
Sample Code
public void onDeviceAdded(String message) {// New Device added}public void onDeviceRemoved(String message) {// Device removed}public void onNotifyDeviceUpdate (String message) {// Device switched}
Handle Application Switch from Foreground to Background
The following methods switch the RTC application to the background and vice versa. The methods allow you to configure whether to continue streaming or pause it after the switch.
Moving Application to Background
The EnxRoom.stopVideoTracksOnApplicationBackground()
method switches the RTC application to the background.
Class: EnxRoom
Method: public void stopVideoTracksOnApplicationBackground(localMuteState, remoteMuteState)
Parameters | Data Type | Description |
---|---|---|
localMuteState |
Boolean | Set it to false to pause local video stream. Set it to true to continue publishing on switching the application to the background. |
remoteMuteState |
Boolean | Set it to false to pause remote video stream. Set it to true to continue receiving on switching the application to the background. |
Sample Code
// When application goes to Backgroundboolean localMuteState = true;boolean remoteMuteState = true;room.stopVideoTracksOnApplicationBackground( localMuteState, remoteMuteState );
Moving Application to Foreground
The EnxRoom.startVideoTracksOnApplicationForeground()
method switches the RTC application to the foreground.
Class: EnxRoom
Method: public void startVideoTracksOnApplicationForeground(localUnmuteState, remoteUnmuteState)
Parameters | Data Type | Description |
---|---|---|
localUnmuteState |
Boolean | Set it to true to resume publishing local video stream if stopped while switching the application to the background. |
remoteUnmuteState |
Boolean | Set it to true to resume receiving remote video streams if stopped while switching the application to the background. |
Sample Code
// When application comes back to Foregroundboolean localUnmuteState = false;boolean remoteUnmuteState = false;room.startVideoTracksOnApplicationForeground(localUnmuteState, remoteUnmuteState);
Note: The application must have android foreground service to use an audio device after moving the application to the background. Otherwise, the application would be unable to capture audio input. For more information, click here.
Detect Local Audio and Noise Energy
To detect local audio speech and noise, set the setVadObserver Observer and add the callbacks to receive notifications.
Observer: public void setVadObserver(EnxVadObserver enxVadObserver)
Callbacks
Callback | Description |
---|---|
public void onSpeechDetected(JSONObject jsonObject) | Notification to the user when speech is detected at their endpoint. |
public void onNoiseDetected(JSONObject jsonObject) | Notification to the user when noise is detected at their endpoint. |
EnableX Proximity Sensor
The EnxRoom.enableProximitySensor()
enables the camera to detect proximity. On most devices, the proximity sensor is implemented as a boolean sensor.
- It returns just two values, NEAR or FAR.
- Thresholding is done on the LUX value, i.e., the light sensor's LUX value is compared with a threshold.
- A LUX value more than the threshold means the proximity sensor returns FAR.
- Anything less than the threshold value, the sensor returns NEAR.
Class: EnxRoom
Method: public void enableProximitySensor(boolean status)
Parameter: status
: Boolean. Set it to true to enable the proximity sensor.
Set it to false to disable the proximity sensor.
Take Image Snapshot of Video Stream
The image from the video stream captures and returns as bitmap image to the callback.
Observer: EnxPlayer.setScreenShotObserver
Method: public void captureScreenShot(EnxScreenShotObserver enxScreenShotObserver)
Callback: OnCapturedView
: To receive bitmap image.
Sample Code
//Set observerenxPlayer.setScreenShotObserver(this)//Capture SnapshotenxPlayer.captureScreenShot(this);//Snapshot captured.public void OnCapturedView(Bitmap bitmap);// bitmap is the Bitmap Image
Share Log with EnableX
EnableX Console Log
To start posting console logs, enable console logging with the EnxUtilityManager.enableLogs()
method.
Class: EnxUtilityManager
Method: public void enableLogs(boolean isEnable)
Parameter: isEnable
: Boolean. Set it to true to enable logging.
Set it to false to disable logging.
Share Console Log
The EnxRoom.postClientLogs()
method is used to share console log with EnableX tech team for audit. The method sends 200KB of the most recent console log to EnableX.
Class: EnxRoom
Method: public void enableLogs(boolean isEnable)
Sample Code
EnxUtilityManager enxUtilityManager = EnxUtilityManager.getInstance(current-class-instance);enxUtilityManager.enableLogs(true); // To enable loggingroom.postClientLogs(); // To upload Log to Enablex// Notified after uploading logpublic void onLogUploaded(JsonObject json) {// json { "result":0, "msg":"Success" }}