CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

CROCOVideoBackground 1.0.0

CROCOVideoBackground 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by CROCODE.



Introduction

Simple Objective C category for Video Backgrounds. CROCOVideoBackground class is a Objective C category that expand from UIView. It provides a simple way to put a video Background into UIView. The class is designed to make it quick and easy show videos, play and stop it. Videos should be .mp4 formats.

Installation

Manual

Copy CROCOVideoBackground.h and CROCOVideoBackground.m to your project. That's it.

Usage

It's is very easy. Just use it like a new feature of a UIView.

Methods

// Setup methods
/*
 * FULL SCREEN Video Background with Background Mode None.
 * Apply on ViewDidLoad
 */
- (void) setBackGroundVideo:(NSString *)videoPath withRepeat:(BOOL)repeat withOverlayColor:(UIColor *)color andAlpha:(CGFloat)alpha;

/*
 * FULL SCREEN Video Background with Background Mode Custom
 * Apply on ViewDidLoad
 */
- (void) setBackGroundVideo:(NSString *)videoPath withRepeat:(BOOL)repeat withOverlayColor:(UIColor *)color andAlpha:(CGFloat)alpha andBackgroundScalingMode:(CROCOVideoBackgroundModes) backgroundMode;

/*
 * FULL SCREEN Video Background with Background Mode Custom and Custom Frame
 * IMPORTANT: Apply on ViewDidAppear
 */
- (void) setBackGroundVideo:(NSString *)videoPath withRepeat:(BOOL)repeat withOverlayColor:(UIColor *)color andAlpha:(CGFloat)alpha andBackgroundScalingMode:(CROCOVideoBackgroundModes) backgroundMode andFrame:(CGRect)frame;

// Interaction methods if needed
- (void)play;
- (void)stop;
- (void)pause;
- (void)restart;

Example Code

[self.viewVideoBackground setBackGroundVideo:@"CrocoVideo" withRepeat:YES withOverlayColor:[UIColor blackColor] andAlpha:0.7 andBackgroundScalingMode:CROCOVideoBackgroundModeAspectFill];

Tipe of scaling

typedef NS_ENUM(NSInteger, CROCOVideoBackgroundModes) {
    CROCOVideoBackgroundModeNone,       // No scaling
    CROCOVideoBackgroundModeAspectFit,  // Uniform scale until one dimension fits
    CROCOVideoBackgroundModeAspectFill, // Uniform scale until the movie fills the visible bounds. One dimension may have clipped contents
    CROCOVideoBackgroundModeFill        // Non-uniform scale. Both render dimensions will exactly match the visible bounds
};