startRtmpOrRecording method

Future<void> startRtmpOrRecording({
  1. required HMSRecordingConfig hmsRecordingConfig,
  2. HMSActionResultListener? hmsActionResultListener,
})

Starts rtmp streaming or recording on the parameters described in config.

Parameters:

hmsRecordingConfig - hmsRecordingConfig is the HMSRecordingConfig which defines streaming/recording parameters for this start request.

hmsActionResultListener - hmsActionResultListener is the callback that would be called by SDK in case of success or failure.

Refer RTMP and Recording guide here

Implementation

Future<void> startRtmpOrRecording(
    {required HMSRecordingConfig hmsRecordingConfig,
    HMSActionResultListener? hmsActionResultListener}) async {
  var arguments = hmsRecordingConfig.getJson();
  var result = await PlatformService.invokeMethod(
      PlatformMethod.startRtmpOrRecording,
      arguments: arguments) as Map?;

  if (hmsActionResultListener != null) {
    if (result == null) {
      hmsActionResultListener.onSuccess(
          arguments: arguments,
          methodType: HMSActionResultListenerMethod.startRtmpOrRecording);
    } else {
      hmsActionResultListener.onException(
          arguments: arguments,
          methodType: HMSActionResultListenerMethod.startRtmpOrRecording,
          hmsException: HMSException.fromMap(result["error"]));
    }
  }
}