WhitePlayer.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. //
  2. // WhitePlayer.h
  3. // WhiteSDK
  4. //
  5. // Created by yleaf on 2019/2/28.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import "WhitePlayerConsts.h"
  9. #import "WhitePlayerState.h"
  10. #import "WhitePlayerTimeInfo.h"
  11. #import "WhiteDisplayer.h"
  12. #import "WhiteSDK+Replayer.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. @interface WhitePlayer : WhiteDisplayer
  15. #pragma mark - 同步 API
  16. @property (nonatomic, copy, readonly) NSString *uuid;
  17. /** 白板回放的阶段。详见 [WhitePlayerPhase](WhitePlayerPhase)。 */
  18. @property (nonatomic, assign, readonly) WhitePlayerPhase phase;
  19. /** 白板回放的状态。详见 [WhitePlayerState](WhitePlayerState)。 */
  20. @property (nonatomic, strong, readonly, nullable) WhitePlayerState *state;
  21. /** 白板回放的时间信息。详见 [WhitePlayerTimeInfo](WhitePlayerTimeInfo)。 */
  22. @property (nonatomic, strong, readonly) WhitePlayerTimeInfo *timeInfo;
  23. #pragma mark - Action API
  24. /**
  25. 开始白板回放。
  26. */
  27. - (void)play;
  28. /**
  29. 暂停白板回放。
  30. */
  31. - (void)pause;
  32. /**
  33. 停止白板回放。
  34. **Note:** 白板回放停止后,`WhitePlayer` 资源会被释放。如果想要重新播放,需要重新初始化 `WhitePlayer` 对象。
  35. */
  36. - (void)stop;
  37. /**
  38. 白板回放的播放倍速,如 1.0、1.5、2.0 倍速,默认为 1.0。
  39. 回放暂停时,返回值不会为 0。
  40. */
  41. @property (nonatomic, assign) CGFloat playbackSpeed;
  42. /**
  43. 设置白板回放的起始播放位置。
  44. 白板回放的起始时间点为 0,成功调用该方法后,白板回放会在指定位置开始播放。
  45. @param beginTime 开始播放位置(秒)
  46. */
  47. - (void)seekToScheduleTime:(NSTimeInterval)beginTime;
  48. /**
  49. 设置白板回放的查看模式。
  50. @param mode 白板回放的查看模式,详见 [WhiteObserverMode](WhiteObserverMode)。
  51. */
  52. - (void)setObserverMode:(WhiteObserverMode)mode;
  53. @end
  54. /**
  55. 用于操作白板的回放。
  56. */
  57. @interface WhitePlayer (Asynchronous)
  58. #pragma mark - get API
  59. /**
  60. 获取白板回放的阶段。
  61. 在 `WhitePlayer` 生命周期内,你可以调用该方法获取白板回放当前所处的阶段。其中初始状态为 `WhitePlayerPhaseWaitingFirstFrame`,表示正在等待白板回放的第一帧。
  62. @param result 回调。返回白板回放的阶段,详见 [WhitePlayerPhase](WhitePlayerPhase)。
  63. */
  64. - (void)getPhaseWithResult:(void (^)(WhitePlayerPhase phase))result;
  65. /**
  66. 获取白板回放的状态。
  67. 如果白板回放的阶段处于 `WhitePlayerPhaseWaitingFirstFrame`,则该方法返回 `null`。
  68. @param result 回调。返回白板回放的状态,详见 [WhitePlayerState](WhitePlayerState)。
  69. */
  70. - (void)getPlayerStateWithResult:(void (^)(WhitePlayerState * _Nullable state))result;
  71. /**
  72. 获取白板回放的时间信息。
  73. 该方法获取的时间信息,包含当前的播放进度,回放的总时长,以及回放的起始时间,单位为秒。
  74. @param result 回调。返回白板回放的时间信息,详见 [WhitePlayerTimeInfo](WhitePlayerTimeInfo)。
  75. */
  76. - (void)getPlayerTimeInfoWithResult:(void (^)(WhitePlayerTimeInfo *info))result;
  77. /**
  78. 设置白板回放的倍速。
  79. 该方法获取的是播放倍速,如 1.0、1.5、2.0 倍速。因此回放暂停时,返回值也不会为 0。
  80. @param result 回调。返回白板回放的倍速。
  81. */
  82. - (void)getPlaybackSpeed:(void (^) (CGFloat speed))result;
  83. @end
  84. NS_ASSUME_NONNULL_END