Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8eabd31931 | |||
| 6c0465b521 | |||
| d77170b2ba | |||
| 419c434503 | |||
| d952f66094 | |||
| c6b94a485a | |||
| 24d9220fad | |||
| 62ed6bc6b7 | |||
| 187c505359 | |||
| 2c1a98a12a | |||
| 2eef6c5b44 | |||
| cabc5535f0 | |||
| e9a88d4a2b | |||
| 7cc44e3eae | |||
| dcddd6b7c3 | |||
| 8e6f8bd448 | |||
| a56f372be8 | |||
| e01e55fa65 | |||
| 3b74f31e22 | |||
| 5d19bc6959 | |||
| b87b020996 | |||
| 7acb7a2dfd | |||
| 84c501810f | |||
| 95994f707f | |||
| 54ad883307 |
@@ -65,3 +65,4 @@ fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
.DS_Store
|
||||
|
||||
+4
-3
@@ -1,11 +1,11 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "ARVideoKit"
|
||||
s.version = "1.3"
|
||||
s.version = "1.5.51"
|
||||
s.summary = "Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆."
|
||||
s.description = "Enabling developers to capture videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆 with augmented reality components."
|
||||
s.homepage = "https://github.com/AFathi/ARVideoKit"
|
||||
s.screenshots = "http://www.ahmedbekhit.com/SK_PREV.gif", "http://www.ahmedbekhit.com/SCN_PREVIEW.gif"
|
||||
s.swift_version = '4.2'
|
||||
s.swift_version = '5.0'
|
||||
|
||||
|
||||
s.license = { :type => "Apache 2.0", :file => "LICENSE" }
|
||||
@@ -16,7 +16,8 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.platform = :ios, "11.0"
|
||||
|
||||
s.source = { :git => "https://github.com/AFathi/ARVideoKit.git", :tag => "1.3" }
|
||||
# ARVideoKit for Swift 5.0
|
||||
s.source = { :git => "https://github.com/AFathi/ARVideoKit.git", :tag => "1.5.51" }
|
||||
s.source_files = "ARVideoKit", "ARVideoKit/**/*.{h,m,swift}"
|
||||
s.resources = "ARVideoKit/Assets/*.scnassets"
|
||||
end
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
FB2E36891FAE29C00035B8D6 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = FB2E36881FAE29BF0035B8D6 /* LICENSE */; };
|
||||
FB404FFE20D72A190056EA1D /* JPEG.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB404FFD20D72A190056EA1D /* JPEG.swift */; };
|
||||
FBD604DF1FA969DD00EC9804 /* ARVideoKit.h in Headers */ = {isa = PBXBuildFile; fileRef = FBD604DD1FA969DD00EC9804 /* ARVideoKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FBD604EB1FA96B1C00EC9804 /* video.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = FBD604EA1FA96B1C00EC9804 /* video.scnassets */; };
|
||||
FBD604EE1FA96B2700EC9804 /* ARVideoOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604EC1FA96B2700EC9804 /* ARVideoOptions.swift */; };
|
||||
FBD604EF1FA96B2700EC9804 /* ARInputViewOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604ED1FA96B2700EC9804 /* ARInputViewOptions.swift */; };
|
||||
FBD604F51FA96B3300EC9804 /* UIImage+VideoBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD604F01FA96B3300EC9804 /* UIImage+VideoBuffer.swift */; };
|
||||
@@ -40,7 +39,6 @@
|
||||
FBD604DA1FA969DD00EC9804 /* ARVideoKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ARVideoKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FBD604DD1FA969DD00EC9804 /* ARVideoKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARVideoKit.h; sourceTree = "<group>"; };
|
||||
FBD604DE1FA969DD00EC9804 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
FBD604EA1FA96B1C00EC9804 /* video.scnassets */ = {isa = PBXFileReference; lastKnownFileType = wrapper.scnassets; path = video.scnassets; sourceTree = "<group>"; };
|
||||
FBD604EC1FA96B2700EC9804 /* ARVideoOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARVideoOptions.swift; sourceTree = "<group>"; };
|
||||
FBD604ED1FA96B2700EC9804 /* ARInputViewOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ARInputViewOptions.swift; sourceTree = "<group>"; };
|
||||
FBD604F01FA96B3300EC9804 /* UIImage+VideoBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+VideoBuffer.swift"; sourceTree = "<group>"; };
|
||||
@@ -110,7 +108,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B466A8B62279E33800BD7070 /* Utils */,
|
||||
FBD604E51FA96ACD00EC9804 /* Assets */,
|
||||
FBD604E61FA96AD400EC9804 /* Enumerations */,
|
||||
FBD604E71FA96AE500EC9804 /* Extensions */,
|
||||
FBD604E81FA96AEC00EC9804 /* Protocols */,
|
||||
@@ -122,14 +119,6 @@
|
||||
path = ARVideoKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FBD604E51FA96ACD00EC9804 /* Assets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FBD604EA1FA96B1C00EC9804 /* video.scnassets */,
|
||||
);
|
||||
path = Assets;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FBD604E61FA96AD400EC9804 /* Enumerations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -252,7 +241,7 @@
|
||||
TargetAttributes = {
|
||||
FBD604D91FA969DD00EC9804 = {
|
||||
CreatedOnToolsVersion = 9.1;
|
||||
LastSwiftMigration = 0910;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
@@ -263,6 +252,7 @@
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = FBD604D01FA969DD00EC9804;
|
||||
productRefGroup = FBD604DB1FA969DD00EC9804 /* Products */;
|
||||
@@ -280,7 +270,6 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FB2E36891FAE29C00035B8D6 /* LICENSE in Resources */,
|
||||
FBD604EB1FA96B1C00EC9804 /* video.scnassets in Resources */,
|
||||
FBD605071FA96B6B00EC9804 /* LoveLiver_LICENSE in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -462,7 +451,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -487,7 +476,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ahmedbekhit.ARVideoKit;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
Binary file not shown.
@@ -5,6 +5,7 @@
|
||||
// Created by Ahmed Bekhit on 10/18/17.
|
||||
// Copyright © 2017 Ahmed Fathi Bekhit. All rights reserved.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// Allows specifying the final video orientation.
|
||||
@objc public enum ARFrameMode: Int {
|
||||
@@ -12,6 +13,7 @@
|
||||
case aspectFit
|
||||
/// Recommended for iPhone X
|
||||
case aspectFill
|
||||
case viewAspectRatio
|
||||
}
|
||||
|
||||
/// Allows specifying the video rendering frame per second `FPS` rate.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import AVFoundation
|
||||
import Photos
|
||||
import UIKit
|
||||
|
||||
@available(iOS 11.0, *)
|
||||
extension RecordAR {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import AVFoundation
|
||||
import Photos
|
||||
import UIKit
|
||||
|
||||
@available(iOS 11.0, *)
|
||||
class LivePhotoGenerator {
|
||||
|
||||
@@ -54,6 +54,13 @@ struct RenderAR {
|
||||
case .aspectFill:
|
||||
width = Int(UIScreen.main.nativeBounds.width)
|
||||
height = Int(UIScreen.main.nativeBounds.height)
|
||||
case .viewAspectRatio where view is UIView:
|
||||
let bufferWidth = CVPixelBufferGetWidth(raw)
|
||||
let bufferHeight = CVPixelBufferGetHeight(raw)
|
||||
let viewSize = (view as! UIView).bounds.size
|
||||
let targetSize = AVMakeRect(aspectRatio: viewSize, insideRect: CGRect(x: 0, y: 0, width: bufferWidth, height: bufferHeight)).size
|
||||
width = Int(targetSize.width)
|
||||
height = Int(targetSize.height)
|
||||
default:
|
||||
if UIScreen.main.isiPhone10 {
|
||||
width = Int(UIScreen.main.nativeBounds.width)
|
||||
|
||||
@@ -27,11 +27,11 @@ import PhotosUI
|
||||
/**
|
||||
An object that passes the AR recorder errors and status in the protocol methods.
|
||||
*/
|
||||
@objc public var delegate: RecordARDelegate?
|
||||
@objc weak public var delegate: RecordARDelegate?
|
||||
/**
|
||||
An object that passes the AR rendered content in the protocol method.
|
||||
*/
|
||||
@objc public var renderAR: RenderARDelegate?
|
||||
@objc weak public var renderAR: RenderARDelegate?
|
||||
/**
|
||||
An object that returns the AR recorder current status.
|
||||
*/
|
||||
@@ -109,6 +109,21 @@ import PhotosUI
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
A boolean that indicates whether render engine should retain SCNTechnique used in the view. Default is `false`.
|
||||
*/
|
||||
@objc public var retainTechnique: Bool = false {
|
||||
didSet {
|
||||
if retainTechnique {
|
||||
guard let techniqueSupportingView = view as? SCNTechniqueSupport else {
|
||||
return
|
||||
}
|
||||
renderEngine?.technique = techniqueSupportingView.technique
|
||||
} else {
|
||||
renderEngine?.technique = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Public initialization methods
|
||||
/**
|
||||
@@ -128,16 +143,9 @@ import PhotosUI
|
||||
view = ARSpriteKit
|
||||
scnView = SCNView(frame: UIScreen.main.bounds)
|
||||
|
||||
let bundle = Bundle(for: RecordAR.self)
|
||||
let url = bundle.url(forResource: "video.scnassets/vid", withExtension: "scn")
|
||||
|
||||
do {
|
||||
let scene = try SCNScene(url: url!, options: nil)
|
||||
scnView.scene = scene
|
||||
setup()
|
||||
}catch let error {
|
||||
logAR.message("Error occurred while loading SK Video Assets : \(error). Please download \"video.scnassets\" from\nwww.ahmedbekhit.com/ARVideoKitAssets")
|
||||
}
|
||||
let scene = SCNScene()
|
||||
scnView.scene = scene
|
||||
setup()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -716,7 +724,7 @@ import PhotosUI
|
||||
Recommended to use in the `UIViewController`'s method `func viewWillAppear(_ animated: Bool)`
|
||||
- parameter configuration: An object that defines motion and scene tracking behaviors for the session.
|
||||
*/
|
||||
@objc public func prepare(_ configuration: ARConfiguration? = nil) {
|
||||
@objc func prepare(_ configuration: ARConfiguration? = nil) {
|
||||
ARcontentMode = contentMode
|
||||
onlyRenderWhileRec = onlyRenderWhileRecording
|
||||
if let view = view as? ARSCNView {
|
||||
@@ -741,7 +749,7 @@ import PhotosUI
|
||||
|
||||
Recommended to use in the `UIViewController`'s method `func viewWillDisappear(_ animated: Bool)`.
|
||||
*/
|
||||
@objc public func rest() {
|
||||
@objc func rest() {
|
||||
ViewAR.orientation = UIInterfaceOrientationMask(ViewAR.orientations)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ahmedbekhit.ARVideoKit-Example";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -451,7 +451,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ahmedbekhit.ARVideoKit-Example";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
+17
-2
@@ -1,8 +1,23 @@
|
||||
// swift-tools-version:4.0
|
||||
// swift-tools-version:5.1
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "ARVideoKit"
|
||||
name: "ARVideoKit",
|
||||
platforms: [
|
||||
.iOS(.v11)
|
||||
],
|
||||
products: [
|
||||
.library(
|
||||
name: "ARVideoKit",
|
||||
targets: ["ARVideoKit"]),
|
||||
],
|
||||
dependencies: [ ],
|
||||
targets: [
|
||||
.target(
|
||||
name: "ARVideoKit",
|
||||
dependencies: [],
|
||||
path: "ARVideoKit")
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
> Use [swift_5](https://github.com/AFathi/ARVideoKit/tree/swift_5) branch for projects written in Swift 5
|
||||
> Use [swift_4_2](https://github.com/AFathi/ARVideoKit/tree/swift_4_2) branch for projects written in Swift 4.2
|
||||
|
||||
> Use [master](https://github.com/AFathi/ARVideoKit/tree/master) branch for projects written in Swift 4.0
|
||||
|
||||
@@ -54,9 +54,10 @@ To try the example project, simply clone this repository and open the `Examples`
|
||||
|
||||
## Installation
|
||||
### Cocoapods
|
||||
1. Add this line to your project's `Podfile`
|
||||
1. Add this line to your project's `Podfile` (for Swift 5.0)
|
||||
```
|
||||
pod 'ARVideoKit'
|
||||
pod 'ARVideoKit', '~> 1.5.51'
|
||||
|
||||
```
|
||||
2. Install the pod
|
||||
```
|
||||
@@ -73,11 +74,13 @@ github "AFathi/ARVideoKit" ~> 1.31
|
||||
$ carthage update
|
||||
```
|
||||
|
||||
### Manual
|
||||
Drag the `ARVideoKit.framework` file as an embedded binary of your project targets. `ARVideoKit.framework` can be found in the `/Framework Build/` folder of this repository.
|
||||

|
||||
### Swift Package Manager (available Xcode 11.2 and forward)
|
||||
|
||||
Or you may drag `ARVideoKit.xcodeproj` into your project and click the **+** button in the embedded binaries section of your project's target.
|
||||
1. In Xcode, select File > Swift Packages > Add Package Dependency.
|
||||
2. Follow the prompts using the URL for this repository.
|
||||
|
||||
### Manual
|
||||
Drag `ARVideoKit.xcodeproj` into your project and click the **+** button in the embedded binaries section of your project's target.
|
||||

|
||||
## Implementation
|
||||
### Swift
|
||||
|
||||
Reference in New Issue
Block a user