Latest 1.1.8
Homepage https://github.com/Th3M4sk8712/TMPlayer
License MIT
Platforms ios 8.0
Dependencies Masonry
Frameworks UIKit, MediaPlayer
Authors

A simple video player for iOS, based on ZFPlayer, by renzifeng. Support the vertical, horizontal screen (lock screen direction). Support adjust volume, brigtness and video progress. Extend support subtitle online/offline.

CI Status
Version
License
Platform

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
  • Subtitle Online/offline (extend feature)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8+
  • Xcode 8+

Installation

TMPlayer is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "TMPlayer"

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;
// Subtitle
self.playerView.addSubtitle(...);
// 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];

Author

Nguyễn Khánh Ngọc, [email protected]

Reference link:


Object-C Player:

See the ZFPlayer please, thanks the ZFPlayer author’s open source.


Swift Player:

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

License

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

Latest podspec

{
    "name": "TMPlayer",
    "version": "1.1.8",
    "summary": "A perfect player based on ZFPlayer",
    "description": "A perfect player based on ZFPlayer made by renzifeng, extend by Nguyu1ec5n Khu00e1nh Ngu1ecdc",
    "homepage": "https://github.com/Th3M4sk8712/TMPlayer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Th3M4sk": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Th3M4sk8712/TMPlayer.git",
        "tag": "1.1.8"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "TMPlayer/**/*.{h,m}",
    "resources": "TMPlayer/ZFPlayer.bundle",
    "frameworks": [
        "UIKit",
        "MediaPlayer"
    ],
    "dependencies": {
        "Masonry": []
    }
}

Pin It on Pinterest

Share This