Git Product home page Git Product logo

crocovideobackground's Introduction

CROCOVideoBackground

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

Cocoapods

Install Cocoapods if need it

$ gem install cocoapods

Add CROCOValidationForms in your Podfile

pod 'CROCOVideoBackground'

Then, run the following command

$ pod install

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
};

crocovideobackground's People

Contributors

damarte avatar pbojeda avatar

Watchers

 avatar

Forkers

seitarus

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.