The Vidyo client library makes a decision in regards to what resolution and frame rate is rendered by the local camera and sent to remote participants in a call. This decision is based on a number of factors including the device's CPU, available bandwidth, size of the view in the UI to render to, battery life, etc.

On mobile platforms (iOS/Android), battery life and temperature of the device are quite important factors in the decision making, for obvious reasons. In certain use cases, a developer may want to override the default behavior of the library and try to push the device harder to yield a greater resolution and frame rate. This can be done by implementing the following code. Note, that this example is for Android, but it would be the same logic on iOS. Also, please be aware that taking this action will drain the battery quicker than the default settings and the device is likely to heat up as well.

1. After construction of the Connector object, set the CPU tradeoff profile to high and register for local camera events:

mVidyoConnector = new Connector(mVideoFrame, Connector.ConnectorViewStyle.VIDYO_CONNECTORVIEWSTYLE_Default, 15,
"info@VidyoClient info@VidyoConnector warning", "", 0);

mVidyoConnector.setCpuTradeOffProfile(Connector.ConnectorTradeOffProfile.VIDYO_CONNECTORTRADEOFFPROFILE_High);

if (!mVidyoConnector.registerLocalCameraEventListener(this)) {
    mLogger.Log("VidyoConnector RegisterLocalCameraEventListener failed");
}

2. Inherit and implement the Connector.IRegisterLocalCameraEventListener interface

public class MainActivity extends Activity implements
   Connector.IConnect,
   Connector.IRegisterLogEventListener,
   Connector.IRegisterNetworkInterfaceEventListener,
   Connector.IRegisterLocalCameraEventListener,
   IVideoFrameListener {

...

@Override
public void onLocalCameraAdded(LocalCamera localCamera) {}

@Override
public void onLocalCameraRemoved(LocalCamera localCamera) {}

@Override
public void onLocalCameraSelected(LocalCamera localCamera) {}

@Override
public void onLocalCameraStateUpdated(LocalCamera localCamera, Device.DeviceState deviceState) {}

3. In the onLocalCameraSelected callback, set the framerate and resolution tradeoff profiles to high. It is important to set both to high as these profiles are coupled in the library.

@Override
public void onLocalCameraSelected(LocalCamera localCamera) {
    localCamera.setFramerateTradeOffProfile(LocalCamera.LocalCameraTradeOffProfile.VIDYO_LOCALCAMERATRADEOFFPROFILE_High);
    localCamera.setResolutionTradeOffProfile(LocalCamera.LocalCameraTradeOffProfile.VIDYO_LOCALCAMERATRADEOFFPROFILE_High);
}

Was this article helpful?
0 out of 0 found this helpful

0 Comments

Follow
Please sign in to leave a comment.