Giter Club home page Giter Club logo

wuxinios / zfplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renzifeng/zfplayer

0.0 2.0 0.0 95.31 MB

Based on AVPlayer, support the vertical, horizontal screen(lock screen direction). Support adjust volume, brigtness and video progress.基于AVPlayer,支持横屏、竖屏(全屏播放还可锁定屏幕方向),上下滑动调节音量、屏幕亮度,左右滑动调节播放进度。

License: MIT License

Objective-C 99.61% Ruby 0.39%

zfplayer's Introduction

ZFPlayer

A simple video player for iOS, based on AVPlayer. Support the vertical, horizontal screen(lock screen direction). Support adjust volume, brigtness and video progress.

中文说明  ZFPlayer剖析  哪些app使用ZFPlayer

Features

  • Support for horizontal and vertical play mode, in horizontal mode can also lock the screen direction
  • Support play with online URL and local file
  • Support in TableviewCell playing video
  • Adjust brightness by slide vertical at left side of screen
  • Adjust volume by slide vertical at right side of screen
  • Slide horizontal to fast forward and rewind
  • Full screen mode to drag the slider control progress, display video preview
  • Download
  • Toggle video resolution

Requirements

  • iOS 7+
  • Xcode 8+

Component

Installation

CocoaPods

pod 'ZFPlayer'

Then, run the following command:

$ pod install

Usage (Support IB and code)

Set status bar color

Please add the "View controller-based status bar appearance" field in info.plist and change it to NO

IB usage

Drag IB to UIView,the View class ZFPlayerView instead

// view
ZFPlayerControlView *controlView = [[ZFPlayerControlView alloc] init];
// model
ZFPlayerModel *playerModel = [[ZFPlayerModel alloc] init];
playerModel.fatherView = ...
playerModel.videoURL = ...
playerModel.title = ...
[self.playerView playerControlView:controlView playerModel:playerModel];
// delegate
self.playerView.delegate = self;
// auto play the video
[self.playerView autoPlayTheVideo];

ZFPlayerDelegate

/** backBtn event */
- (void)zf_playerBackAction;
/** downloadBtn event */
- (void)zf_playerDownload:(NSString *)url;
Code implementation (Masonry) usage
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);
	// Here a 16:9 aspect ratio, can customize the video aspect ratio
    make.height.equalTo(self.playerView.mas_width).multipliedBy(9.0f/16.0f);
}];
// control view(you can custom)
ZFPlayerControlView *controlView = [[ZFPlayerControlView alloc] init];
// model
ZFPlayerModel *playerModel = [[ZFPlayerModel alloc]init];
playerModel.fatherView = ...
playerModel.videoURL = ...
playerModel.title = ...
[self.playerView playerControlView:controlView playerModel:playerModel];

// delegate
self.playerView.delegate = self;
// auto play the video
[self.playerView autoPlayTheVideo];
Set the fill mode for the video
 // 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;
Is there a breakpoint download function
 // 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
// Play video from XX seconds
playerModel.seekTime = 15;
Automatically play the video,not automatically play by default
// Automatically play the video
[self.playerView autoPlayTheVideo];
Set the video placeholderImage
//  The video placeholder image
// If network image and local image set at the same time, ignore the local image, display the network images
ZFPlayerModel *playerModel = [[ZFPlayerModel alloc]init];
// local image
playerModel.placeholderImage = [UIImage imageNamed: @"..."];
// network image
playerModel.placeholderImageURLString = @"https://xxx.jpg";
self.playerView.playerModel = playerModel;

Picture demonstration

Picture effect

Sound adjustment demonstration

Brightness adjustment demonstration

Fast adjustment demonstration

Progress adjustment demonstration

Reference link:


Swift Player:

See the BMPlayer please, thanks the BMPlayer author's open source.


Contact me

License

ZFPlayer is available under the MIT license. See the LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.