Custom interface video player which has various interactive gestures.
Add pod 'SRVideoPlayer' to the Podfile, then run pod install in the terminal.
Drag the SRVideoPlayer folder to the project.(Note: If the project has already import Masonry, you should remove it which in the SRVideoPlayer folder.)
/** Creates and returns a video player with video's URL, playerView and playerSuperView. @param videoURL The URL of the video. @param playerView The view which you want to display the video. @param playerSuperView The playerView's super view. @return A newly video player. */ + (instancetype)playerWithVideoURL:(NSURL *)videoURL playerView:(UIView *)playerView playerSuperView:(UIView *)playerSuperView; - (void)play; - (void)pause; - (void)resume; - (void)destroyPlayer;
UIView *playerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width)]; playerView.center = self.view.center; [self.view addSubview:playerView]; _videoPlayer = [SRVideoPlayer playerWithVideoURL:_videoURL playerView:playerView playerSuperView:playerView.superview]; _videoPlayer.videoName = @"Here Is The Video Name"; _videoPlayer.playerEndAction = SRVideoPlayerEndActionLoop; [_videoPlayer play];
/** The action when the video play to end, default is SRVideoPlayerEndActionStop. */ @property (nonatomic, assign) SRVideoPlayerEndAction playerEndAction; /** The name of the video which will be displayed in the top center. */ @property (nonatomic, copy) NSString *videoName;
Submit an issue or email me if you have any questions. email@example.com