public async Task <AsyncCallbackMsg> StartRecord(List <LiveVideoStream> liveVideoStreamInfos) { if (string.IsNullOrEmpty(RecordDirectory)) { return(AsyncCallbackMsg.GenerateMsg(Messages.WarningRecordDirectoryNotSet)); } if (RecordParam.Width == 0 || RecordParam.Height == 0 || RecordParam.VideoBitrate == 0) { return(AsyncCallbackMsg.GenerateMsg(Messages.WarningRecordResolutionNotSet)); } AsyncCallbackMsg result = await _sdkService.SetRecordDirectory(RecordDirectory); AsyncCallbackMsg setRecordParamResult = await _sdkService.SetRecordParameter(RecordParam); string recordFileName = $"{DateTime.Now:yyyy_MM_dd_HH_mm_ss}.mp4"; Log.Logger.Debug( $"【local record live begins】:width={RecordParam.Width}, height={RecordParam.Height}, bitrate={RecordParam.VideoBitrate}, path={Path.Combine(RecordDirectory, recordFileName)}, videos={liveVideoStreamInfos.Count}"); for (int i = 0; i < liveVideoStreamInfos.Count; i++) { Log.Logger.Debug( $"video{i + 1}:x={liveVideoStreamInfos[i].X}, y={liveVideoStreamInfos[i].Y}, width={liveVideoStreamInfos[i].Width}, height={liveVideoStreamInfos[i].Height}"); } AsyncCallbackMsg localRecordResult = await _sdkService.StartRecord(recordFileName, liveVideoStreamInfos.ToArray(), liveVideoStreamInfos.Count); if (localRecordResult.Status == 0) { RecordId = int.Parse(localRecordResult.Data.ToString()); Log.Logger.Debug($"【local record live succeeded】:liveId={RecordId}"); } else { Log.Logger.Error($"【local record live failed】:{localRecordResult.Message}"); } return(localRecordResult); }