XG_PlayerManager.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // MyPlayer.h
  3. // XGAssetPickerController
  4. //
  5. // Created by huxinguang on 2018/11/8.
  6. // Copyright © 2018年 huxinguang. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. @protocol XG_PlayerManagerDelegate;
  11. @interface XG_PlayerManager : NSObject
  12. @property (nonatomic, assign) BOOL loopPlay;
  13. @property (nonatomic, weak) id<XG_PlayerManagerDelegate> delegate;
  14. @property (nonatomic, strong) AVPlayerItem *playerItem;
  15. @property (nonatomic, assign) BOOL isSeekInProgress;
  16. + (instancetype)shareInstance;
  17. - (void)playWithItem:(AVPlayerItem *)item onLayer:(CALayer *)superlayer;
  18. - (void)resetPlayer;
  19. - (void)play;
  20. - (void)pause;
  21. - (void)seekSmoothlyToTime:(CMTime)newChaseTime;
  22. @end
  23. @protocol XG_PlayerManagerDelegate<NSObject>
  24. @optional
  25. - (void)playerReadyToPlay:(XG_PlayerManager *)manager;
  26. - (void)playerDidLoadToProgress:(float)progress;
  27. - (void)playerDidPlayToTime:(CMTime)currentTime totalTime:(CMTime)totalTime;
  28. - (void)playerPlaybackBufferEmpty;
  29. - (void)playerPlaybackLikelyToKeepUp;
  30. - (void)playerDidFinishPlay:(XG_PlayerManager *)manager;
  31. - (void)playerDidFailToPlay:(XG_PlayerManager *)manager;
  32. @end