Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b923fac2f9 | |||
| 9e103afc7b | |||
| b7e1facded | |||
| 63c9ebb500 | |||
| 3162fa72fb | |||
| 0c9a76a77a | |||
| e2ba1ac1c3 | |||
| 092413fb42 | |||
| 7596d066a6 | |||
| 275f850486 | |||
| e150e00203 | |||
| e2d5e537e3 | |||
| 1ef5e99fe7 | |||
| 62a6c6a89a | |||
| e8dae8c989 | |||
| 2d87e3e7e7 | |||
| 74a3159c70 | |||
| 589e6e77d4 | |||
| d1c840e383 | |||
| ae9c620621 |
+2
-3
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "ARVideoKit"
|
||||
s.version = "1.5.51"
|
||||
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"
|
||||
@@ -17,7 +17,6 @@ Pod::Spec.new do |s|
|
||||
s.platform = :ios, "11.0"
|
||||
|
||||
# ARVideoKit for Swift 5.0
|
||||
s.source = { :git => "https://github.com/AFathi/ARVideoKit.git", :tag => "1.5.51" }
|
||||
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
|
||||
|
||||
@@ -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, *)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ struct RenderAR {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,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!
|
||||
@@ -725,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")
|
||||
@@ -761,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.")
|
||||
@@ -770,7 +771,6 @@ extension RecordAR {
|
||||
logAR.message("ERROR:- An error occurred while rendering the camera buffer.")
|
||||
return
|
||||
}
|
||||
renderer.ARcontentMode = contentMode
|
||||
|
||||
self.writerQueue.sync {
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
> Use [master](https://github.com/AFathi/ARVideoKit/tree/master) branch for projects written in Swift 4.0
|
||||
|
||||
## Sponsors
|
||||
[**Chemical Wedding**](https://www.chemicalwedding.tv)
|
||||
|
||||

|
||||
|
||||
## ARVideoKit
|
||||
|
||||

|
||||
|
||||
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. |
|
||||
|[](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¤cy_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 |
|
||||
@@ -146,7 +154,7 @@ To do so, follow those steps:
|
||||
Donations will support me to keep maintining **ARVideoKit Framework** ❤️
|
||||
|
||||
[](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¤cy_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!
|
||||
|
||||
@@ -155,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. You’re only limited to your imagination and your battery life. |
|
||||
|
||||
_Feel free to add your application to this list!_
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user