VideoPlayer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #import <CoreMedia/CMTime.h>
  3. @class AVPlayer;
  4. @interface VideoPlayerView : UIView {}
  5. @property(nonatomic, retain) AVPlayer* player;
  6. @end
  7. @protocol VideoPlayerDelegate<NSObject>
  8. - (void)onPlayerReady;
  9. - (void)onPlayerDidFinishPlayingVideo;
  10. - (void)onPlayerError:(NSError*)error;
  11. @end
  12. @interface VideoPlayer : NSObject
  13. {
  14. id<VideoPlayerDelegate> delegate;
  15. }
  16. @property (nonatomic, retain) id delegate;
  17. @property (nonatomic, readonly) AVPlayer* player;
  18. + (BOOL)CanPlayToTexture:(NSURL*)url;
  19. + (BOOL)CheckScalingModeAspectFill:(CGSize)videoSize screenSize:(CGSize)screenSize;
  20. - (BOOL)loadVideo:(NSURL*)url;
  21. - (BOOL)readyToPlay;
  22. - (void)unloadPlayer;
  23. - (BOOL)playToView:(VideoPlayerView*)view;
  24. - (BOOL)playToTexture;
  25. - (BOOL)playVideoPlayer;
  26. - (BOOL)isPlaying;
  27. - (intptr_t)curFrameTexture;
  28. - (void)pause;
  29. - (void)resume;
  30. - (void)rewind;
  31. - (void)seekToTimestamp:(CMTime)time;
  32. - (void)seekTo:(float)timeSeconds;
  33. - (BOOL)setAudioVolume:(float)volume;
  34. - (CMTime)duration;
  35. - (float)durationSeconds;
  36. - (CGSize)videoSize;
  37. @end