Latest 1.2.4
Homepage https://github.com/skswhwo/AVPlayerView
License MIT
Platforms ios 7.0, requires ARC
Authors

AVPlayer module that implemented by subclass of UIView class

  • Support constraints and XIB implementation
  • Support autoplay, loop mode
  • Support appear, disappear callback
  • Support tap gesture callback
  • Support simple control
  • Easy to use

alt text
alt text
alt text
alt text
alt text

Installation

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

pod "AVPlayerView"

And then run:

$ pod install

Usage

#import <AVPlayerView/CrAVPlayerView.h>
AVPlayerView *avPlayerView  = [[AVPlayerView alloc] initWithFrame:CGRectMake(0, 0, 300, 200)];
NSString *path = [[NSBundle mainBundle] pathForResource:@"short" ofType:@"mp4"];
[avPlayerView playerWithContentURL:[NSURL fileURLWithPath:path]];
avPlayerView.autoplay           = YES;
avPlayerView.loop               = YES;
avPlayerView.dimmedEffect       = YES;
avPlayerView.pauseWhenDisappear = YES;                  //default: true
avPlayerView.showControl        = NO;                   //default: true
self.backgroundColorForFullSize = [UIColor blackColor]; //default: black

[avPlayerView setTapCallBack:^(AVPlayerView *playerView) {
    if (playerView.isFullSize) {
        [playerView normalSizeMode];
    } else {
        [playerView fullSizeMode];
    }
}];

[self.avPlayerView setDidAppear:^(AVPlayerView *playerView) {
    //do somthing;
}];

[self.avPlayerView setDidDisappear:^(AVPlayerView *playerView) {
    //do somthing;
}];

[self.avPlayerView setFailure:^(AVPlayerView *playerView) {
        //do somthing;
}];
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
[self.avPlayerView playerWithContentURL:[NSURL fileURLWithPath:path]];
self.pauseWhenDisappear         = YES;                  //default: true
self.avPlayerView.showControl   = YES;                  //default: true
self.backgroundColorForFullSize = [UIColor blackColor]; //default: black

[self.avPlayerView setTapCallBack:^(AVPlayerView *playerView) {
    //do something;
}];
[self.avPlayerView setDidAppear:^(AVPlayerView *playerView) {
    //do something;
}];
[self.avPlayerView setDidDisappear:^(AVPlayerView *playerView) {
    //do something;
}];
[self.avPlayerView setFailure:^(AVPlayerView *playerView) {
        //do somthing;
    }];

Author

skswhwo, [email protected]

License

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

Latest podspec

{
    "name": "AVPlayerView",
    "version": "1.2.4",
    "platforms": {
        "ios": "7.0"
    },
    "summary": "AVPlayer module that implemented by subclass of UIView class",
    "homepage": "https://github.com/skswhwo/AVPlayerView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "skswhwo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/skswhwo/AVPlayerView.git",
        "tag": "1.2.4"
    },
    "source_files": "AVPlayerView/Classes/**/*.{h,m}",
    "resources": "AVPlayerView/Assets/**/*.{png,bundle,xib,nib,xcassets}",
    "requires_arc": true
}

Pin It on Pinterest

Share This