public async Task <LocalRecordResult> StartRecord(List <LiveVideoStreamInfo> liveVideoStreamInfos) { if (string.IsNullOrEmpty(RecordDirectory)) { return(new LocalRecordResult() { m_result = new AsynCallResult() { m_rc = -1, m_message = Messages.WarningRecordDirectoryNotSet } }); } if (RecordParam.Width == 0 || RecordParam.Height == 0 || RecordParam.VideoBitrate == 0) { return(new LocalRecordResult() { m_result = new AsynCallResult() { m_rc = -1, m_message = Messages.WarningLiveResolutionNotSet } }); } int result = await _sdkService.SetRecordDirectory(RecordDirectory); AsynCallResult setRecordParamResult = await _sdkService.SetRecordParam(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].XLocation}, y={liveVideoStreamInfos[i].YLocation}, width={liveVideoStreamInfos[i].Width}, height={liveVideoStreamInfos[i].Height}"); } LocalRecordResult localRecordResult = await _sdkService.StartRecord(recordFileName, liveVideoStreamInfos.ToArray(), liveVideoStreamInfos.Count); RecordId = localRecordResult.m_liveId; if (localRecordResult.m_result.m_rc == 0) { Log.Logger.Debug($"【local record live succeeded】:liveId={localRecordResult.m_liveId}"); } else { Log.Logger.Error($"【local record live failed】:{localRecordResult.m_result.m_message}"); } return(localRecordResult); }