DZVideoPlayerViewController
DZVideoPlayerViewController copied to clipboard
Customizable iOS Video Player control, implemented with AVPlayer.
DZVideoPlayerViewController
What is it
iOS Video Player control, implemented with AVPlayer.
Screenshots
2)
3)
4)
About
iOS Video Player control that features
- play online or offline videos
- playback controls: play, pause, toggle fullscreen, current time and left time labels
- progress indicator that shows downloaded amount and allows the user to rewind
- remote command center support
- remote control (headset) support
- background playback
- now playing info updates
- easy customization with Interface Builder
- has several styles to choose from
- default style is similiar to MPMoviePlayerViewController
Usage
This pod contains an Example project showing how to play local file and implement fullscreen expand and shrink transitioning.
You can find more example usage of this control here at OhMyTube github page.
Basic snippet to start with:
self.videoPlayerViewController.delegate = self;
self.videoPlayerViewController.videoURL = [NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
self.videoPlayerViewController.isBackgroundPlaybackEnabled = YES;
[self.videoPlayerViewController prepareAndPlayAutomatically:YES];
Implement DZVideoPlayerViewControllerDelegate
#pragma mark - <DZVideoPlayerViewControllerDelegate>
- (void)playerFailedToLoadAssetWithError:(NSError *)error {
}
- (void)playerDidPlay {
}
- (void)playerDidPause {
}
- (void)playerDidStop {
}
- (void)playerDidToggleFullscreen {
if (self.videoPlayerViewController.isFullscreen) {
// TODO: implement expand videoPlayerViewController to fullscreen
}
else {
// TODO: implement shrink videoPlayerViewController from fullscreen
}
}
- (void)playerDidPlayToEndTime {
}
- (void)playerFailedToPlayToEndTime {
}
- (void)playerPlaybackStalled {
}
- (void)playerGatherNowPlayingInfo:(NSMutableDictionary *)nowPlayingInfo {
// [nowPlayingInfo setObject:self.video.author forKey:MPMediaItemPropertyArtist];
[nowPlayingInfo setObject:self.video.title forKey:MPMediaItemPropertyTitle];
}
Requirements
Version 0.2.* and above runs on iOS 8.0 and later. Version 0.1.* runs on iOS 7.0 and later.
Customization
There are at least 3 ways to customize this control.
- Create custom XIB and hook up the Outlets as they appear in default XIB (
DZVideoPlayerViewController.xib
). No need to hook actions, because they will be added programmatically in theDZVideoPlayerViewController
class. - Subclass
DZVideoPlayerViewController
and provide your overrides for different methods. - Manipulate views by their public properties. Set images for
playButton
andpauseButton
, change tint color onprogressIndicator
, hidefullscreenExpandButton
andfullscreenShrinkButton
if you don't want that feature.
Feel free to provide Pull Requests with custom XIBs you create. Good luck!
Installation
DZVideoPlayerViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DZVideoPlayerViewController"
Similar Controls
Author
Denis Zamataev, [email protected]
License
DZVideoPlayerViewController is available under the MIT license. See the LICENSE file for more info.