Latest 1.0.6
Homepage https://github.com/tomjpsun/JustPlayer
License MIT
Platforms ios 7.0, requires ARC
Frameworks AVFoundation
Authors

Just Player

Overview

Just Player is a very simple wrapper for Cocoa AVPlayer. It wrapps complicated usage of AVPlayer. For those who want to use AVPlayer in a super easy way, and tweek in her/his later need.

Steps of Usage

Assume we declare a ‘player’ property of type JustPlayer* in our view controller like this:


    #import "JustPlayer.h"
    #import "JustPlayerLayerView.h"

    @interface ViewController ()
    @property (nonatomic, strong) JustPlayer *player;
    @end

allocate

    self.player = [[JustPlayer alloc] init];

ready to play block

When it is ready to play, this block will be called.

Basically we have to call [play:] inside, you can
tweek your own.

    __weak ViewController *weak = self;

    self.player.blkPlayerItemReady = ^(AVPlayerItemStatus

    status) {

        if (AVPlayerItemStatusReadyToPlay == status) {

            [weak.player play];

        }
        else {

            NSLog(@"player item status is %d", status);

        }
    };

load range block (optional)

On playing, it will fetch next segmant of video asset, and
notifies us.

        self.player.blkPlayerItemLoadTimeRange = ^(float start, float duration) {

        NSLog(@"get range (%.1f, %.1f)", start, duration);

    };

setup URL to play

        [self.player prepareForURL: url];

setup display

Use storyboard to add a UIView UI object, set it as JustPlayerLayerView class, and make it as an outlet of
your view controller, say :

    #import "JustPlayerLayerView.h"
    @interface ViewController : UIViewController
    @property (weak, nonatomic) IBOutlet JustPlayerLayerView *playerLayer;

Set the outlet view as the ‘display’ of JustPlayer:

    [self.playerLayer setPlayer: self.player.player];

note

License

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

Latest podspec

{
    "name": "JustPlayer",
    "version": "1.0.6",
    "platforms": {
        "ios": "7.0"
    },
    "license": {
        "type": "MIT"
    },
    "summary": "A super-easy way of using AVPlayer which is fully customizable on later need",
    "homepage": "https://github.com/tomjpsun/JustPlayer",
    "authors": {
        "J.P. Sun": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tomjpsun/JustPlayer.git",
        "tag": "1.0.6"
    },
    "description": "JustPlayer is a wrapper of Cocoa AVPlayer, which provides a minimal core functions for Audio/Video playing. It is easy to use on start, and can be easily modified for later need.",
    "source_files": "*.{h,m}",
    "frameworks": "AVFoundation",
    "requires_arc": true
}

Pin It on Pinterest

Share This