37 Commits

Author SHA1 Message Date
Ahmed Bekhit b923fac2f9 Merge pull request #130 from fattalgazi/swift_5
Update README.md
2021-07-13 16:54:09 -04:00
isa 9e103afc7b Update README.md 2021-07-13 22:33:57 +03:00
Ahmed Bekhit b7e1facded Merge pull request #122 from seriyvolk83/audio_crash_fix
Fixing potential crash #101
2020-12-09 17:47:19 -05:00
Ahmed Bekhit 63c9ebb500 Merge pull request #117 from Jlack6/patch-1
Update README.md
2020-12-09 17:46:13 -05:00
Ahmed Bekhit 3162fa72fb Update README.md 2020-11-19 16:10:43 +03:00
Alexander Volkov 0c9a76a77a Handling flag properly 2020-11-10 12:16:49 +03:00
Alexander Volkov e2ba1ac1c3 Adding check 2020-11-10 12:08:45 +03:00
Alexander Volkov 092413fb42 Fixing potential crash 2020-11-10 11:54:57 +03:00
James Lack 7596d066a6 Update README.md
Added ScribScrab to the Apps using ARVideoKit
2020-09-11 09:23:50 -04:00
Ahmed Bekhit 275f850486 Merge pull request #115 from mattbierner/patch-1
Add In The Walls app
2020-08-30 16:07:01 -04:00
Ahmed Bekhit e150e00203 Update README.md 2020-08-21 17:24:48 -04:00
Matt Bierner e2d5e537e3 Add In The Walls app
Adds [In The Walls](https://apps.apple.com/us/app/id1522257130) to the readme. We use this library for recording video
2020-08-05 19:43:35 -07:00
Ahmed Bekhit 1ef5e99fe7 Merge pull request #113 from shaj04/ARRenderer_content_mode_bugfix
adjust when to set renderer.ARcontentMode
2020-08-01 20:31:52 -04:00
Ahmed Bekhit 62a6c6a89a Update README.md 2020-07-30 21:50:13 -04:00
shajie e8dae8c989 adjust when to set renderer.ARcontentMode 2020-06-12 19:00:46 +08:00
Ahmed Bekhit 2d87e3e7e7 Merge pull request #111 from AFathi/CocoaPodsUpdate-patch-1
Update to latest version
2020-04-25 15:58:46 -04:00
Giacomo 74a3159c70 Update to latest version 2020-04-23 15:27:12 +02:00
Ahmed Bekhit 589e6e77d4 Merge pull request #108 from 0k1019/feature/MaxDevice
Fix iPhone X Max, XS Max, 11Pro Max size recording size problem.
2020-04-15 17:20:06 -04:00
Youngho Kwon d1c840e383 Update isNotch function consider when landscape mode. 2020-04-09 16:12:18 +09:00
Youngho Kwon ae9c620621 Fix iPhone X Max, XS Max, 11Pro Max size recording size problem. Renewing "isiPhone10" extension to "isNotch". 2020-03-24 15:41:44 +09:00
Ahmed Bekhit 8eabd31931 Merge pull request #105 from GiacomoLeopizzi/swift_package_manager
Swift package manager
2020-02-27 11:26:27 -05:00
Giacomo 6c0465b521 Merge pull request #2 from GiacomoLeopizzi/swift_5
Update
2020-02-26 16:58:54 +01:00
Giacomo d77170b2ba Merge pull request #1 from AFathi/swift_5
Update
2020-02-26 16:56:11 +01:00
Giacomo 419c434503 Readme updated 2020-02-26 16:42:59 +01:00
Giacomo d952f66094 Remove not needed files 2020-02-26 16:34:41 +01:00
Giacomo c6b94a485a SwiftPM 2020-02-26 16:26:20 +01:00
Ahmed Bekhit 24d9220fad Merge pull request #104 from GiacomoLeopizzi/weak_delegate
Added weak
2020-02-20 15:39:03 -08:00
Giacomo 62ed6bc6b7 Added weak 2020-02-20 23:40:53 +01:00
Giacomo 187c505359 Merge branch 'view_aspect_ratio' into swift_package_manager 2020-02-13 12:11:48 +02:00
Giacomo 2c1a98a12a Dynamic library 2020-02-13 12:09:05 +02:00
Giacomo 2eef6c5b44 Swift package manager 2020-02-13 11:50:54 +02:00
Ahmed Bekhit cabc5535f0 Merge pull request #100 from GiacomoLeopizzi/view_aspect_ratio
Support for custom aspect ratio
2020-02-09 10:44:13 -08:00
Giacomo e9a88d4a2b Support for custom aspect ratio 2020-02-09 14:21:27 +01:00
Ahmed Bekhit 7cc44e3eae Update README.md 2020-01-10 13:39:31 -05:00
Ahmed Bekhit dcddd6b7c3 Update + validate podspec file 2020-01-10 13:01:26 -05:00
Ahmed Bekhit 8e6f8bd448 Update podspec file 2020-01-10 12:40:55 -05:00
Ahmed Bekhit a56f372be8 Update podspec file 2020-01-10 12:36:22 -05:00
13 changed files with 73 additions and 46 deletions
+1
View File
@@ -65,3 +65,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
.DS_Store
+3 -3
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ARVideoKit"
s.version = "1.3"
s.version = "1.6.0"
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"
@@ -16,7 +16,7 @@ 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.6.0" }
s.source_files = "ARVideoKit", "ARVideoKit/**/*.{h,m,swift}"
s.resources = "ARVideoKit/Assets/*.scnassets"
end
-12
View File
@@ -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 = (
@@ -281,7 +270,6 @@
buildActionMask = 2147483647;
files = (
FB2E36891FAE29C00035B8D6 /* LICENSE in Resources */,
FBD604EB1FA96B1C00EC9804 /* video.scnassets in Resources */,
FBD605071FA96B6B00EC9804 /* LoveLiver_LICENSE in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
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 {
+2 -2
View File
@@ -14,8 +14,8 @@ extension UIScreen {
/**
`isiPhone10` is a boolean that returns if the device is iPhone X or not.
*/
var isiPhone10: Bool {
return self.nativeBounds.size == CGSize(width: 1125, height: 2436) || self.nativeBounds.size == CGSize(width: 2436, height: 1125)
var isNotch: Bool {
return UIApplication.shared.keyWindow?.safeAreaInsets != UIEdgeInsets.zero
}
}
@available(iOS 11.0, *)
@@ -8,6 +8,7 @@
import AVFoundation
import Photos
import UIKit
@available(iOS 11.0, *)
class LivePhotoGenerator {
+9 -2
View File
@@ -44,7 +44,7 @@ struct RenderAR {
if let contentMode = ARcontentMode {
switch contentMode {
case .auto:
if UIScreen.main.isiPhone10 {
if UIScreen.main.isNotch {
width = Int(UIScreen.main.nativeBounds.width)
height = Int(UIScreen.main.nativeBounds.height)
}
@@ -54,8 +54,15 @@ 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 {
if UIScreen.main.isNotch {
width = Int(UIScreen.main.nativeBounds.width)
height = Int(UIScreen.main.nativeBounds.height)
}
+7 -2
View File
@@ -152,7 +152,7 @@ class WritAR: NSObject, AVCaptureAudioDataOutputSampleBufferDelegate {
audioInput.expectsMediaDataInRealTime = true
audioBufferQueue.async {
self.session.startRunning()
self.session?.startRunning()
}
if assetWriter.canAdd(audioInput) {
@@ -208,7 +208,10 @@ class WritAR: NSObject, AVCaptureAudioDataOutputSampleBufferDelegate {
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
if let input = audioInput {
audioBufferQueue.async { [weak self] in
if input.isReadyForMoreMediaData && (self?.isRecording)! {
if let isRecording = self?.isRecording,
let session = self?.session,
input.isReadyForMoreMediaData && isRecording
&& session.isRunning {
input.append(sampleBuffer)
}
}
@@ -227,6 +230,7 @@ class WritAR: NSObject, AVCaptureAudioDataOutputSampleBufferDelegate {
}
if assetWriter.status == .writing {
isRecording = false
assetWriter.finishWriting(completionHandler: finished)
}
}
@@ -237,6 +241,7 @@ class WritAR: NSObject, AVCaptureAudioDataOutputSampleBufferDelegate {
session.stopRunning()
}
}
isRecording = false
assetWriter.cancelWriting()
}
}
+8 -15
View File
@@ -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.
*/
@@ -143,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()
}
/**
@@ -179,7 +172,6 @@ import PhotosUI
private var renderEngine: SCNRenderer!
private var gpuLoop: CADisplayLink!
private var isResting = false
private var ARcontentMode: ARFrameMode!
private var renderer: RenderAR!
private var scnView: SCNView!
@@ -732,7 +724,7 @@ import PhotosUI
- parameter configuration: An object that defines motion and scene tracking behaviors for the session.
*/
@objc func prepare(_ configuration: ARConfiguration? = nil) {
ARcontentMode = contentMode
renderer.ARcontentMode = contentMode
onlyRenderWhileRec = onlyRenderWhileRecording
if let view = view as? ARSCNView {
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
@@ -768,6 +760,8 @@ extension RecordAR {
//frame rendering
if self.onlyRenderWhileRec && !isRecording && !isRecordingGIF { return }
renderer.ARcontentMode = contentMode
guard let buffer = renderer.buffer else { return }
guard let rawBuffer = renderer.rawBuffer else {
logAR.message("ERROR:- An error occurred while rendering the camera's main buffers.")
@@ -777,7 +771,6 @@ extension RecordAR {
logAR.message("ERROR:- An error occurred while rendering the camera buffer.")
return
}
renderer.ARcontentMode = contentMode
self.writerQueue.sync {
+17 -2
View File
@@ -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")
]
)
+22 -8
View File
@@ -1,7 +1,14 @@
> 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
## Sponsors
[**Chemical Wedding**](https://www.chemicalwedding.tv)
![Chemical Wedding](https://www.chemicalwedding.tv/imgs/general/logo-main.png)
## ARVideoKit
![intro image](http://www.ahmedbekhit.com/projects/repo-header-arvideokit.png)
An iOS Framework that enables developers to capture videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆 with ARKit content.
@@ -20,6 +27,7 @@ In other words, you **NO LONGER** have to ~screen record~/~screenshot~ to captur
| [Implementation](#implementation) | Lists the [steps needed](#implementation) for Objective-C & Swift, [notes](#note), and [reference](#youre-all-set-) for more options |
| [Publishing to the App Store](#publishing-to-the-app-store) | Describes the steps **required** before submitting an application using `ARVideoKit` to the App Store. |
|[![Donate](https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ahmedfbekhit@gmail.com&item_name=Support+ARVideoKit+Developer&item_number=ARVideoKit+Framework+Donations&amount=0%2e00&currency_code=USD) | [Donations](#donate) will support me to keep maintaining `ARVideoKit` ❤️|
|[Sponsors](#sponsors) | Featuring the sponsors of this project |
| [Contributions](#contributions) | Describes how you can contribute to this project |
| [Apps using ARVideoKit](#apps-using-arvideokit) | A list of published applications using ARVideoKit |
| [License](#license) | Describes `ARVideoKit` license |
@@ -54,9 +62,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 +82,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.
![Tutorial](http://www.ahmedbekhit.com/arvideokit_install_new.gif)
### 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.
![example embed framework](http://www.ahmedbekhit.com/embeddedBinary.png)
## Implementation
### Swift
@@ -143,7 +154,7 @@ To do so, follow those steps:
Donations will support me to keep maintining **ARVideoKit Framework** ❤️
[![Donate](https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ahmedfbekhit@gmail.com&item_name=Support+ARVideoKit+Developer&item_number=ARVideoKit+Framework+Donations&amount=0%2e00&currency_code=USD)
## Contributions
If you have an idea for a new **ARVideoKit** feature/functionality and want to add it to this repository, feel free to fork the project and create a pull request!
@@ -152,7 +163,10 @@ Also, feel free to create an issue if you have any suggestions or need any help
## Apps using ARVideoKit
| App | Description |
| ------------------ |:------------------:|
| [Pathica](https://apps.apple.com/us/app/pathica/id1564780182) | The first proof of the theory of "six degrees of separation" which is the idea that any two people on the planet can be connected through five or fewer individuals. |
| [Our SolAR](https://itunes.apple.com/app/id1267675913) | An app that allows you to see our Solar System anywhere at all! |
| [In The Walls](https://apps.apple.com/us/app/id1522257130) | Uses real time face tracking and AR to put your face in any real world wall! |
| [ScribScrab](https://apps.apple.com/in/app/scribscrab/id1339432955) | ScribScrab is a tool for creativity. Youre only limited to your imagination and your battery life. |
_Feel free to add your application to this list!_
## License