createRTCEngine static method

FutureOr<RTCEngine> createRTCEngine(
  1. EngineConfig config,
  2. IRTCEngineEventHandler handler
)

@detail api @author wangzhanqiang @brief Creates an engine instance.
This is the very first API that you must call if you want to use all the RTC capabilities.
If there is no engine instance in current process, calling this API will create one. If an engine instance has been created, calling this API again will have the created engine instance returned. @param config SDK Engine Config,see EngineConfig{@link #EngineConfig} @param handler Handler sent from SDK to App. See IRTCEngineEventHandler{@link #IRTCEngineEventHandler} @return - RTCEngine: A successfully created engine instance. - Null: EngineConfig is inValid see EngineConfig{@link #EngineConfig}. Failed to load the so file @note The lifecycle of the handler must be longer than that of the RTCEngine, i.e. the handler must be created before calling createRTCEngine{@link #RTCEngine#createRTCEngine} and destroyed after calling destroyRTCEngine{@link #RTCEngine#destroyRTCEngine}.

Implementation

static FutureOr<RTCEngine> createRTCEngine(
    EngineConfig config, IRTCEngineEventHandler handler) async {
  final result = await NativeClassUtils.nativeStaticCall(
    _$namespace,
    'createRTCEngine',
    [config, handler],
    'com.volcengine.rtc.hybrid_runtime',
  );
  return packObject(result,
      () => RTCEngine(const NativeClassOptions([], disableInit: true)));
}