About NKJMovieComposer
The NKJMovieComposer framework is a powerful tool for creating and editing movies in iOS apps. It provides a simple and intuitive interface for adding audio, video, images, and text to create stunning movies. With NKJMovieComposer, you can easily combine different media assets, apply various effects, and customize the look and feel of your movies.
Installation
-
Open your project in Xcode.
-
Go to File > Swift Packages > Add Package Dependency.
-
In the search bar, enter “https://github.com/nakajijapan/NKJMovieComposer.git”.
-
Select the correct package from the search results and click Next.
-
Choose the desired version and click Next.
-
Xcode will resolve the package and ask you to choose the target where you want to add it.
-
Make sure the “Add to Target” checkbox is selected and click Finish.
Usage
-
Import the framework in the file where you want to use it:
import NKJMovieComposer
-
Create an instance of NKJMovieComposer and set up the movie composition:
let movieComposer = NKJMovieComposer() movieComposer.addVideo(url: videoURL) movieComposer.addAudio(url: audioURL) movieComposer.addImage(image: backgroundImage, duration: 5.0) movieComposer.addText(text: "Hello World", duration: 2.0)
-
Customize the movie composition by applying various effects and animations:
movieComposer.applyFilter(filter: .sepia) movieComposer.applyAnimation(animation: .fadeIn)
-
Export the movie composition to a file or preview it in your app:
let outputPath = NSTemporaryDirectory().appending("output.mov") movieComposer.export(to: URL(fileURLWithPath: outputPath)) { success, error in if success { // Movie exported successfully } else { // Error occurred during export } } // Preview the composition in a video player let playerViewController = AVPlayerViewController() playerViewController.player = AVPlayer(url: movieComposer.previewURL) present(playerViewController, animated: true) { playerViewController.player?.play() }
Features
- Easy integration and setup with Swift Package Manager.
- Supports adding videos, audios, images, and texts as assets to the movie composition.
- Includes various filters and animations to customize the look and feel.
- Provides exporting capabilities to save the movie composition as a file.
- Offers preview functionality within the app using AVPlayerViewController.
Requirements
- iOS 11.0+.
- Swift 5.0+.
License
NKJMovieComposer is released under the MIT license. See the LICENSE file for more details.