publishDefaultLiveStreams method

Future<void> publishDefaultLiveStreams(
  1. void onSuccess(
    1. RCRTCLiveInfo liveInfo
    ),
  2. void onError(
    1. int code,
    2. String? message
    )
)

Implementation

Future<void> publishDefaultLiveStreams(
  void onSuccess(RCRTCLiveInfo liveInfo),
  void onError(int code, String? message),
) async {
  String? json = await methodChannel.invokeMethod('publishDefaultLiveStreams');
  Map<String, dynamic> result = jsonDecode(json!);
  RCRTCLog.d(_tag, "publishDefaultLiveStreams $result");
  int code = result['code'] ?? -1;
  String? content = result["content"];
  if (code == 0) {
    onSuccess(RCRTCLiveInfo.fromJSON(jsonDecode(content!)));
  } else {
    onError(code, content);
  }
}