Giter VIP home page Giter VIP logo

wsdynamicalbummaker's Introduction

WSDynamicAlbumMaker

An easy-to-use utility for merging photos to into a video, written in Swift.


  • Support iOS 8, Swift 1.2, xCode6.3.
  • Singleton pattern, just few lines of code for using.
  • Can compose Photos into a video file with a background music.
  • Customized CALayer Animation can been exported into a video file.

##Usage Create your own CAAnimation, and pass it to WSDynamicAlbumMaker.

let videoURL = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("BaseVideo", ofType: "m4v")!)    //  1
let audioURL = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("music", ofType: "mp3")!)        // *2 

let renderLayerSize = WSDynamicAlbumMaker.sharedInstance.querySizeWithAssetURL(videoURL: videoURL!)         // *3
let albumLayer = createSequenceAlbumCALayer(renderLayerSize)                                                //  4
let duration = 10                                                                                           //  5

WSDynamicAlbumMaker.sharedInstance.createDynamicAlbum(videoURL: videoURL!, renderLayer: albumLayer, duration: duration, completionBlock: { (url, error) -> Void in
    if let err = error {
        // error accured during exporting
    } else {
    	// export DONE!
    	// you can do more with the *url*
    	playVideo(url!)
    }
	return
})

In the Code :

  1. Prepare a 1s-length-video, just used as a canvas to draw CAAnimations on, so really don't care about the video's content.
  2. Choose the background music. (also you can ignore it, to create a silent video)
  3. Ask WSDynamicAlbumMaker for the size of the rendering video which you create in setp 1, and you can make your animation based on the Size.
  4. Create a CALayer instance, with all animation setted up, this CALayer instance will be persistented into a video file.
  5. Point out the Animation's duration.
  6. Go create the Dynamic Album, WSDynamicAlbumMaker will generate a video with the content of the animations in the CALayer instance .

About more pleace checkout the Demo.


##Demo Project Screenshot

#####1.Startup screen startup screen

#####2.Pick photos pick photos

#####3.Generating video Generating video

#####4.Done and play the video Done and play the video

wsdynamicalbummaker's People

Contributors

wangshuaidavid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

110440

wsdynamicalbummaker's Issues

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.