
# 初始化等基础接口
 #### create
```
public static synchronized HRTCEngine create(HRTCEngineConfig config, IHRTCEngineEventHandler eventHandler)
```
【**功能说明**】
创建SparkRTC引擎实例。
【**请求参数** 】
- config：引擎创建相关参数，具体请参见[HRTCEngineConfig](https://support.huaweicloud.com/csdk-rtc/rtc_05_0037.html#rtc_05_0037__section10520125124410)。
- eventHandler：引擎事件句柄，用于加入房间、离开房间等事件回调，具体请参见[IHRTCEngineEventHandler](https://support.huaweicloud.com/csdk-rtc/rtc_05_0025.html)。
 
【**返回参数**】
返回引擎实例对象。
 #### destroy
```
public static synchronized void destroy()
```
【**功能说明**】
销毁SparkRTC引擎。
【**请求参数**】
无
【**返回参数**】
无
![](https://support.huaweicloud.com/csdk-rtc/public_sys-resources/caution_3.0-zh-cn.png)
请不要在RTC SDK的接口回调函数中直接调用此方法，请切回业务线程后调用。
 #### logUpload
```
public abstract int logUpload();
```
【**功能说明**】
上传日志。
【**请求参数**】
无
【**返回参数** 】
- 0：成功。
- \>0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
![](https://support.huaweicloud.com/csdk-rtc/public_sys-resources/caution_3.0-zh-cn.png)
- 加入房间成功后才能主动上传日志。
- 会触发以下回调：
  - [onLogUploadResult](https://support.huaweicloud.com/csdk-rtc/rtc_05_0025.html#rtc_05_0025__section3516125621)：日志上传结果回调。
  
  - [onLogUploadProgress](https://support.huaweicloud.com/csdk-rtc/rtc_05_0025.html#rtc_05_0025__section121001648068)：日志上传进度回调。
   
 
 #### disableRejoinRoom
```
public abstract int disableRejoinRoom(boolean disable);
```
【**功能说明**】
设置是否禁用房间重连功能。
【**请求参数**】
disable：true表示禁用，false表示不禁用。
【**返回参数**】
- 0：成功。
- \> 0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
 #### enableStats
```
public abstract int enableStats(boolean enabled);
```
【**功能说明**】
打点功能开关，在[create]之后调用。默认开启。
【**请求参数**】
enabled：是否打开打点功能开关，true表示打开，false表示关闭。
【**返回参数** 】
- 0：成功。
- \> 0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
 #### getVersion
```
public static String getVersion();
```
【**功能说明**】
获取SDK版本号。
【**返回参数**】
SDK版本号。
 #### setEncryption
```
public abstract int setEncryption(HRTCEncryptionConfig encryptionParam);
```
【**功能说明**】
设置端到端加密方式。需要在加入房间前设置生效。其中sdk加密模式，需要设置16位加密密钥和加密算法，app加密模式需要先设置回调接口。
【**请求参数**】
encryptionParam：加密配置，具体请参见[HRTCEncryptionConfig](https://support.huaweicloud.com/csdk-rtc/rtc_05_0037.html#rtc_05_0037__section412619421339)。
【**返回参数**】
- 0：成功。
- \<0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
 #### setAccessResourceType
```
public abstract int setAccessResourceType(int resType);
```
【**功能说明**】
设置接入的环境，不支持跨房间场景。
【**请求参数**】
- resType：环境类型。
- 0：公网sfu资源。
- 1：公司局Sfu。
- 2：MPC。
- 3：LLL
【**返回参数**】
- 0：成功。
- \<0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
 #### setNetworkBandwidth
```
public abstract int setNetworkBandwidth(HRTCNetworkBandwidth bandwidthParam);
```
【**功能说明**】
设置网络带宽限制。需要在每次加入房间之前设置。
【**请求参数**】
bandwidthParam：带宽设置参数，具体请参见[HRTCNetWorkBandwidth](https://support.huaweicloud.com/csdk-rtc/rtc_05_0037.html#rtc_05_0037__section16347162134919)。
【**返回参数**】
- 0：成功。
- \<0：失败。具体请参见[客户端错误码](https://support.huaweicloud.com/csdk-rtc/rtc_05_0035.html)。
 
