IMediaPlayerCustomDataProvider.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. namespace Agora.Rtc
  3. {
  4. ///
  5. /// <summary>
  6. /// The Callback for custom media resource files.
  7. /// </summary>
  8. ///
  9. public abstract class IMediaPlayerCustomDataProvider
  10. {
  11. ///
  12. /// <summary>
  13. /// Occurs when the SDK seeks the media resource data.
  14. /// </summary>
  15. ///
  16. /// <param name="offset"> An input parameter. The offset of the target position relative to the starting point, in bytes. The value can be positive or negative.</param>
  17. ///
  18. /// <param name="whence"> An input parameter. The starting point. You can set it as one of the following values:0: The starting point is the head of the data, and the actual data offset after seeking is offset.1: The starting point is the current position, and the actual data offset after seeking is the current position plus offset.2: The starting point is the end of the data, and the actual data offset after seeking is the whole data length plus offset.65536: Do not perform position seeking, return the file size. Agora recommends that you use this parameter value when playing pure audio files such as MP3 and WAV.</param>
  19. ///
  20. /// <returns>
  21. /// When when ce is 65536, the media file size is returned.When when ce is 0, 1, or 2, the actual data offset after the seeking is returned.-1: Seeking failed.
  22. /// </returns>
  23. ///
  24. public virtual Int64 OnSeek(Int64 offset, int whence)
  25. {
  26. return 0;
  27. }
  28. ///
  29. /// <summary>
  30. /// Occurs when the SDK reads the media resource data.
  31. /// </summary>
  32. ///
  33. /// <param name="bufferPtr"> An input parameter. Data buffer (bytes). Write the bufferSize data reported by the SDK into this parameter.</param>
  34. ///
  35. /// <param name="bufferSize"> The length of the data buffer (bytes).</param>
  36. ///
  37. /// <returns>
  38. /// If the data is read successfully, pass in the length of the data (bytes) you actually read in the return value.If reading the data fails, pass in 0 in the return value.
  39. /// </returns>
  40. ///
  41. public virtual int OnReadData(IntPtr bufferPtr, int bufferSize)
  42. {
  43. return 0;
  44. }
  45. }
  46. }