- Support for horizontal and vertical screen switch, in full screen playback mode can also lock the screen direction
- Support local video, network video playback
- Support in TableviewCell playing video
- The left 1/2 position on the sliding screen brightness adjustment (simulator can't adjust brightness, please in the real machine debugging)
- The right 1/2 position on the sliding screen volume adjustment (simulator can't adjust the volume, please in the real machine debugging)
- Left and right sliding adjustment play schedule
- Breakpoint Download
- Toggle video resolution
- iOS 8+
- Xcode 6.0+
- Breakpoint Download: ZFDownload
- Layout: Masonry
pod 'ZFPlayer'
Then, run the following command:
$ pod install
Please add the "View controller-based status bar appearance" field in info.plist and change it to NO
Direct drag IB to UIView, the aspect ratio for the 16:9 constraint (priority to 750, lower than the 1000 line), the code section only needs to achieve
self.playerView.videoURL = self.videoURL;
// Back button event
__weak typeof(self) weakSelf = self;
self.playerView.goBackBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
self.playerView = [[ZFPlayerView alloc] init];
[self.view addSubview:self.playerView];
[self.playerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(20);
make.left.right.equalTo(self.view);
// Note here, the aspect ratio 16:9 priority is lower than 1000 on the line, because the 4S iPhone aspect ratio is not 16:9
make.height.equalTo(self.playerView.mas_width).multipliedBy(9.0f/16.0f).with.priority(750);
}];
self.playerView.videoURL = self.videoURL;
// Back button event
__weak typeof(self) weakSelf = self;
self.playerView.goBackBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
// (optional settings) you can set the fill mode of the video, the default settings (ZFPlayerLayerGravityResizeAspect: wait for a proportional fill, until a dimension reaches the area boundary).
self.playerView.playerLayerGravity = ZFPlayerLayerGravityResizeAspect;
// Default is to close the breakpoint download function, such as the need for this feature set here
self.playerView.hasDownload = YES;
// Play video from XX seconds
self.playerView.seekTime = 15;
- https://segmentfault.com/a/1190000004054258
- http://sky-weihao.github.io/2015/10/06/Video-streaming-and-caching-in-iOS/
- https://developer.apple.com/library/prerelease/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html#//apple_ref/doc/uid/TP40010188-CH3-SW8
See the BMPlayer please, thanks the BMPlayer author's open source.
I recently written ZFZhiHuDaily.
- Weibo: @任子丰
- Email: zifeng1300@gmail.com
- QQ Group: 213376937
ZFPlayer is available under the MIT license. See the LICENSE file for more info.