NKJMovieComposer is very simple movie composer for iOS.
NKJMovieComposer is very simple movie composer for iOS.
NKJMovieComposer higher requires Xcode 6, targeting either iOS 8.0 and above, or Mac OS 10.10 OS X and above.
CocoaPods is a dependency manager for Cocoa projects. CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod "NKJMovieComposer", '~> 1.0'
Then, run the following command:
$ pod install
Carthage is a decentralized dependency manager for Cocoa application.
$ brew update
$ brew install carthage
To integrate Kingfisher into your Xcode project using Carthage, specify it in your Cartfile
:
github "nakajijapan/NKJMovieComposer"
Then, run the following command to build the Kingfisher framework:
$ carthage update
let movieComposition = NKJMovieComposer()
Append Movies.
// movie
let movieURL = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("movie001", ofType: "mov"))
layerInstruction = movieComposition.addVideo(movieURL)
// compose
self.assetExportSession = movieComposition.readyToComposeVideo(composedMoviePath)
let composedMovieUrl = NSURL.fileURLWithPath(composedMoviePath)
// export
self.assetExportSession.exportAsynchronouslyWithCompletionHandler({() -> Void in
// save to device
var library = ALAssetsLibrary()
if library.videoAtPathIsCompatibleWithSavedPhotosAlbum(composedMovieUrl) {
library.writeVideoAtPathToSavedPhotosAlbum(composedMovieUrl, completionBlock: {(assetURL, assetError) -> Void in
// something code
})
}
})
nakajijapan
NKJMovieComposer is available under the MIT license. See the LICENSE file for more info.