publishLiveStream method

void publishLiveStream(
  1. RCRTCOutputStream stream,
  2. void onSuccess(
    1. RCRTCLiveInfo liveInfo
    ),
  3. void onError(
    1. int code,
    2. String? message
    )
)

Implementation

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