Automatic play video & cache video data in UITableView like Weibo and Douyin.
This library provides an video player with cache support in UITableView
base on AVPlayer
.
This project has abandoned due to personal reason.
由于日常工作比较忙,没有精力继续维护该项目,抱歉。
UITableViewCell
or any view.
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_playVideoMuteWithURL:url
bufferingIndicator:nil
progressView:nil
configuration:nil];
UITableViewController
to a detail UIViewController
when user selected a UITableViewCell
.
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_resumeMutePlayWithURL:url
bufferingIndicator:nil
progressView:nil
configuration:nil];
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_playVideoWithURL:url
bufferingIndicator:nil
controlView:nil
progressView:nil
configuration:nil];
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_resumePlayWithURL:url
bufferingIndicator:nil
controlView:nil
progressView:nil
configuration:nil];
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_playVideoWithURL:url
options:kNilOptions
configuration:nil];
NSURL *url = [NSURL URLWithString:@"http://p11s9kqxf.bkt.clouddn.com/bianche.mp4"];
[aview jp_resumePlayWithURL:url
options:kNilOptions
configuration:nil];
[aview jp_gotoLandscape];
[aview jp_gotoLandscapeAnimated:YES completion:nil];
[aview jp_gotoPortrait];
[aview jp_gotoPortraitAnimated:YES completion:nil];
UITableView
like Weibo
.Play video in UITableView
support equal height and un-eqaul height cell now, you can use a category method on UITableView
directly. You also should set the jp_tableViewVisibleFrame
accurately to insure playing video on the cell that closest to the center of the screen.
[tableView jp_playVideoInVisibleCellsIfNeed];
[tableView jp_handleCellUnreachableTypeInVisibleCellsAfterReloadData];
[tableView jp_handleCellUnreachableTypeForCell:cell
atIndexPath:indexPath];
[tableView jp_scrollViewDidScroll];
[tableView jp_scrollViewDidEndDraggingWillDecelerate:decelerate];
[tableView jp_scrollViewDidEndDecelerating];
This library offered a basic JPVideoPlayerProgressView
、JPVideoPlayerBufferingIndicator
、JPVideoPlayerControlView
, so you can pass nil in play video method. You can inherit those basic class to custom your own UI, and you also can not inherit it, directly use your own UI, but you must implete the method in JPVideoPlayerControlProgressProtocol
、JPVideoPlayerBufferingProtocol
、JPVideoPlayerProtocol
.
[JPVideoPlayerCache.sharedCache calculateSizeOnCompletion:^(NSUInteger fileCount, NSUInteger totalSize) {
// do something.
}];
[JPVideoPlayerCache.sharedCache clearDiskOnCompletion:^{
// do something
}];
There are two ways to use JPVideoPlayer
in your project:
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.
platform :ios, '8.0'
target "YourProjectName" do
pod 'JPVideoPlayer'
end
All source code is licensed under the MIT License.