RtcEngineConfig
Configurations for the RtcEngineConfig instance.
public class RtcEngineConfig { public Context mContext; public String mAppId; public Constants.AreaCode mAreaCode; public IAgoraEventHandler mEventHandler; public int mChannelProfile; public int mAudioScenario; public List<String> mExtensionList; public IMediaExtensionObserver mExtensionObserver; public LogConfig mLogConfig; public String mNativeLibPath; public static class LogConfig { public String filePath; public int fileSizeInKB; public int level = Constants.LogLevel.getValue(Constants.LogLevel.LOG_LEVEL_INFO); @CalledByNative("LogConfig") public String getFilePath() { return filePath; } @CalledByNative("LogConfig") public int getFileSize() { return fileSizeInKB; } @CalledByNative("LogConfig") public int getLevel() { return level; } } public RtcEngineConfig() { mContext = null; mAppId = ""; mChannelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING; mEventHandler = null; mAreaCode = Constants.AreaCode.AREA_CODE_GLOB; mExtensionList = new ArrayList<>(); mExtensionObserver = null; mLogConfig = new LogConfig(); } public void addExtension(String providerName) { mExtensionList.add(providerName); } @CalledByNative public Context getContext() { return mContext; } @CalledByNative public String getAppId() { return mAppId; } @CalledByNative public int getChannelProfile() { return mChannelProfile; } @CalledByNative public int getAudioScenario() { return mAudioScenario; } @CalledByNative public int getAreaCode() { return Constants.AreaCode.getValue(mAreaCode); } @CalledByNative public IMediaExtensionObserver getExtensionObserver() { return mExtensionObserver; } @CalledByNative public LogConfig getLogConfig() { return mLogConfig; } }
Attributes
- mEventHandler
- The event handler for RtcEngine. See IRtcEngineEventHandler.
- mAppId
- The App ID issued by Agora for your project. Only users in apps with the same App ID can join the same channel and communicate with each other. An App ID can only be used to create one RtcEngine instance. To change your App ID, call destroy to destroy the current RtcEngine instance, and then create a new one.
- mContext
-
The context of Android Activity.
- mNativeLibPath
-
Specifies the storage directory for the
.so
files. The storage directory must be a valid and private directory of the app, which can be obtained usingContext.getDir()
.- If you set this parameter, the SDK automatically loads the
.so
files in the directory you specify, so that the app dynamically loads the required.so
files when it runs, thereby reducing the package size. - If you do not set this parameter or set it to null, the SDK loads the
.so
files from the default app'snativeLibraryPath
when compiling the app, which increases the package size compared to the previous method.
Attention:- This method is applicable when you integrate the SDK manually but not when you integrate the SDK with Maven Central or JitPack.
- Ensure the specified directory exists; otherwise, the RtcEngine initialization fails.
- If you set this parameter, the SDK automatically loads the
- mChannelProfile
-
The channel profile.
- CHANNEL_PROFILE_COMMUNICATION(0): Communication. Use this profile when there are only two users in the channel.
- CHANNEL_PROFILE_LIVE_BROADCASTING(1): Live streaming. Use this profile when there are more than two users in the channel.
- CHANNEL_PROFILE_GAME(2): This profile is deprecated.
- CHANNEL_PROFILE_CLOUD_GAMING(3): Interaction. The scenario is optimized for latency. Use this profile if the use case requires frequent interactions between users.
- mAudioScenario
- The audio scenarios. Under different audio scenarios, the device uses different volume types.
- AUDIO_SCENARIO_DEFAULT(0): Automatic scenario match, where the SDK chooses the appropriate audio quality according to the user role and audio route.
- AUDIO_SCENARIO_GAME_STREAMING(3): High-quality audio scenario, where users mainly play music.
- AUDIO_SCENARIO_CHATROOM(5): Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. In this scenario, audience members receive a pop-up window to request permission of using microphones.
- AUDIO_SCENARIO_CHORUS(7): Real-time chorus scenario, where users have good network conditions and require ultra-low latency.Attention: Before using this enumeration, you need to call getAudioDeviceInfo to get whether the audio device supports ultra-low-latency capture and playback. Only on audio devices that support ultra-low latency (isLowLatencyAudioSupported =
true
) can you experience ultra-low latency. - AUDIO_SCENARIO_MEETING(8): Meeting scenario that mainly involves the human voice.
- mAreaCode
- The region for connection. This is an advanced feature and applies to scenarios that have regional restrictions. For details on supported regions, see AreaCode. The area codes support bitwise operation.
- mLogConfig
-
Sets the log file size. See LogConfig.
By default, the SDK generates five SDK log files and five API call log files with the following rules:
- The SDK log files are:
agorasdk.log
,agorasdk.1.log
,agorasdk.2.log
,agorasdk.3.log
, andagorasdk.4.log
. - The API call log files are:
agoraapi.log
,agoraapi.1.log
,agoraapi.2.log
,agoraapi.3.log
, andagoraapi.4.log
. - The default size for each SDK log file is 1,024 KB; the default size for each API call log file is 2,048 KB. These log files are encoded in UTF-8.
- The SDK writes the latest logs in
agorasdk.log
oragoraapi.log
. - When
agorasdk.log
is full, the SDK processes the log files in the following order:- Delete the
agorasdk.4.log
file (if any). - Rename
agorasdk.3.log
toagorasdk.4.log
. - Rename
agorasdk.2.log
toagorasdk.3.log
. - Rename
agorasdk.1.log
toagorasdk.2.log
. - Create a new
agorasdk.log
file.
- Delete the
- The overwrite rules for the
agoraapi.log
file are the same as foragorasdk.log
.
- The SDK log files are:
- mExtensionList
- Extension libraries.
- mExtensionObserver
- The IMediaExtensionObserver instance.
- domainLimit
-
Whether to enable domain name restriction:
true
: Enables the domain name restriction. This value is suitable for scenarios where IoT devices use IoT cards for network access. The SDK will only connect to servers in the domain name or IP whitelist that has been reported to the operator.false
: (Default) Disables the domain name restriction. This value is suitable for most common scenarios.
Method
- addExtension
- Adds the extension. See addExtension.