Skip to content

Commit

Permalink
1.5.8 #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Datt1994 committed Jul 29, 2020
1 parent 619313c commit 8def434
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 127 deletions.
2 changes: 1 addition & 1 deletion DPVideoMerger-Swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "DPVideoMerger-Swift"
s.version = "1.5.7"
s.version = "1.5.8"
s.summary = "Multiple videos merge in one video with manage scale & aspect ratio and also merge 4 videos to grid layout for Swift."

# This description is used to generate tags and improve search results.
Expand Down
4 changes: 2 additions & 2 deletions DPVideoMerger/DPVideoMerger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.5.7;
MARKETING_VERSION = 1.5.8;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.datt.DPVideoMerger-Swift";
Expand Down Expand Up @@ -503,7 +503,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.5.7;
MARKETING_VERSION = 1.5.8;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.datt.DPVideoMerger-Swift";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint">
<BreakpointContent
uuid = "89B45419-AB85-49F7-9837-4F1D85772B06"
uuid = "C05F5A5C-C63A-4E24-81A7-93BCE4A33777"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "9B3EFF14-9314-4B2A-9CD8-53FFFFC8D09B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "DPVideoMerger/DPVideoMerger.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "343"
endingLineNumber = "343"
landmarkName = "gridMergeVideos(withFileURLs:videoResolution:isRepeatVideo:videoDuration:videoQuality:completion:)"
landmarkType = "7">
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
Expand Down
336 changes: 225 additions & 111 deletions DPVideoMerger/DPVideoMerger/DPVideoMerger.swift

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions DPVideoMerger/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="DPVideoMerger" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="DPVideoMerger_Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -24,12 +24,22 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Se-HH-pFy">
<rect key="frame" x="224" y="0.0" width="136" height="30"/>
<state key="normal" title="Grid Merage Videos"/>
<rect key="frame" x="275" y="0.0" width="85" height="30"/>
<state key="normal" title="Grid Merage"/>
<connections>
<action selector="btnGridMergeVideoAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="LiS-hn-LlU"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HcS-W4-8K4">
<rect key="frame" x="127.5" y="0.0" width="120" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="a7d-Ly-wk2"/>
</constraints>
<state key="normal" title="Parallel Merage"/>
<connections>
<action selector="btnParallelMerageAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Ur3-VG-wbu"/>
</connections>
</button>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="tGh-fG-U9l">
<rect key="frame" x="15" y="45" width="345" height="622"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -40,7 +50,7 @@
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" restorationIdentifier="VideoImgCell" reuseIdentifier="VideoImgCell" id="4LU-or-GTz" customClass="VideoImgCell" customModule="DPVideoMerger" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" restorationIdentifier="VideoImgCell" reuseIdentifier="VideoImgCell" id="4LU-or-GTz" customClass="VideoImgCell" customModule="DPVideoMerger_Example" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="117" height="116"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
Expand Down Expand Up @@ -85,6 +95,8 @@
<constraint firstItem="1Se-HH-pFy" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="XSd-Vo-Ihh"/>
<constraint firstItem="q1t-LM-rN3" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="be8-A2-rf1"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="tGh-fG-U9l" secondAttribute="trailing" constant="15" id="lEM-J3-7bP"/>
<constraint firstItem="HcS-W4-8K4" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="pCu-1d-2VO"/>
<constraint firstItem="HcS-W4-8K4" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="wVa-o7-bmH"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
Expand Down
52 changes: 52 additions & 0 deletions DPVideoMerger/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,58 @@ class ViewController: UIViewController {

}

@IBAction func btnParallelMerageAction(_ sender: UIButton) {

if arrIndex.count == 0 {
print("please select video")
return
}
activityIndicatorView.isHidden = false
activityIndicatorView.startAnimating()
view.isUserInteractionEnabled = false
// let fileURL = Bundle.main.url(forResource: "1", withExtension: "mp4")
// let fileURL1 = Bundle.main.url(forResource: "2", withExtension: "mp4")
// let fileURL2 = Bundle.main.url(forResource: "3", withExtension: "MOV")
// let fileURL3 = Bundle.main.url(forResource: "4", withExtension: "mp4")
// let fileURLs = [fileURL, fileURL1, fileURL2, fileURL3]
var fileURLs = [URL]()
// arrIndex.enumerateObjects({ indexPath, idx, stop in
for indexPath in arrIndex {
let object = self.arrImgAssets[indexPath.row]
self.imageManager.requestAVAsset(forVideo: object, options: nil, resultHandler: { asset, audioMix, info in
let url = ((asset as? AVURLAsset)?.url)?.standardizedFileURL
// if let url = url {
// print("\(url)")
// }
// print("url = \(url?.absoluteString ?? "")")
// print("url = \(url?.relativePath ?? "")")
if let url = url {
fileURLs.append(url)
}
if fileURLs.count == self.arrIndex.count {
DPVideoMerger().parallelMergeVideos(withFileURLs: fileURLs, videoResolution: CGSize(width: 1000, height: 900),isRepeatVideo: true, videoQuality:AVAssetExportPresetHighestQuality , alignment: .vertical ,completion: {(_ mergedVideoFile: URL?, _ error: Error?) -> Void in
self.activityIndicatorView.stopAnimating()
self.view.isUserInteractionEnabled = true
self.activityIndicatorView.isHidden = true
if error != nil {
let errorMessage = "Could not merge videos: \(error?.localizedDescription ?? "error")"
let alert = UIAlertController(title: "Error", message: errorMessage, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (a) in
}))
self.present(alert, animated: true) {() -> Void in }
return
}
let objAVPlayerVC = AVPlayerViewController()
objAVPlayerVC.player = AVPlayer(url: mergedVideoFile!)
self.present(objAVPlayerVC, animated: true, completion: {() -> Void in
objAVPlayerVC.player?.play()
})

})
}
})
}
}
}

extension ViewController : UICollectionViewDelegate , UICollectionViewDataSource , UICollectionViewDelegateFlowLayout {
Expand Down
Binary file modified DPVideoMerger_Swift.framework.zip
Binary file not shown.

0 comments on commit 8def434

Please sign in to comment.