VideoPlayer.h 1.0 KB

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