IMediaRecorder.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. namespace Agora.Rtc
  2. {
  3. ///
  4. /// <summary>
  5. /// Used for recording audio and video on the client.
  6. /// IMediaRecorder can record the following:
  7. /// The audio captured by the local microphone and encoded in AAC format.The video captured by the local camera and encoded by the SDK.
  8. /// </summary>
  9. ///
  10. public abstract class IMediaRecorder
  11. {
  12. ///
  13. /// <summary>
  14. /// Registers one IMediaRecorderObserver object.
  15. /// Make sure the IRtcEngine is initialized before you call this method.
  16. /// </summary>
  17. ///
  18. /// <param name="connection"> The connection information. See RtcConnection .</param>
  19. ///
  20. /// <param name="callback"> The callbacks for recording local audio and video streams. See IMediaRecorderObserver .</param>
  21. ///
  22. /// <returns>
  23. /// 0: Success.&lt; 0: Failure.
  24. /// </returns>
  25. ///
  26. public abstract int SetMediaRecorderObserver(RtcConnection connection, IMediaRecorderObserver callback);
  27. ///
  28. /// <summary>
  29. /// Starts recording the local audio and video.
  30. /// After successfully getting the IMediaRecorder object by calling GetMediaRecorder , you can call this method to enable the recoridng of the local audio and video.This method can record the audio captured by the local microphone and encoded in AAC format, and the video captured by the local camera and encoded in H.264 format. The SDK can generate a recording file only when it detects audio and video streams; when there are no audio and video streams to be recorded or the audio and video streams are interrupted for more than five seconds, the SDK stops the recording and triggers the OnRecorderStateChanged(RECORDER_STATE_ERROR, RECORDER_ERROR_NO_STREAM) callback.Once the recording is started, if the video resolution is changed, the SDK stops the recording; if the sampling rate and audio channel changes, the SDK continues recording and generates audio files respectively.Call this method after joining a channel.
  31. /// </summary>
  32. ///
  33. /// <param name="connection"> The connection information. See RtcConnection .</param>
  34. ///
  35. /// <param name="config"> The recording configuration. See MediaRecorderConfiguration .</param>
  36. ///
  37. /// <returns>
  38. /// 0: Success.&lt; 0: Failure.2: The parameter is invalid. Ensure the following:The specified path of the recording file exists and is writable.The specified format of the recording file is supported.The maximum recording duration is correctly set.4: IRtcEngine does not support the request. The recording is ongoing or the recording stops because an error occurs.7: A method is called before IRtcEngine is initialized.
  39. /// </returns>
  40. ///
  41. public abstract int StartRecording(RtcConnection connection, MediaRecorderConfiguration config);
  42. ///
  43. /// <summary>
  44. /// Stops recording the local audio and video.
  45. /// After calling StartRecording , if you want to stop the recording, you must call this method; otherwise, the generated recording files may not be playable.
  46. /// </summary>
  47. ///
  48. /// <param name="connection"> The connection information. See RtcConnection .</param>
  49. ///
  50. /// <returns>
  51. /// 0: Success.&lt; 0: Failure.-7: A method is called before IRtcEngine is initialized.
  52. /// </returns>
  53. ///
  54. public abstract int StopRecording(RtcConnection connection);
  55. };
  56. }