Updated example project
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
FB2E368C1FAE2A510035B8D6 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = FB2E368B1FAE2A510035B8D6 /* LICENSE */; };
|
||||
FB9B5D2E1FC49E3E005DDD60 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB9B5D2D1FC49E3E005DDD60 /* MainViewController.swift */; };
|
||||
FBD3F1E61FB260B000327054 /* ARVideoKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBD3F1E51FB260B000327054 /* ARVideoKit.framework */; };
|
||||
FBD3F1E71FB260B000327054 /* ARVideoKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FBD3F1E51FB260B000327054 /* ARVideoKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
FBDCC5E71FABDFC600E3184D /* Scene.sks in Resources */ = {isa = PBXBuildFile; fileRef = FBDCC5E51FABDFC500E3184D /* Scene.sks */; };
|
||||
@@ -15,7 +16,7 @@
|
||||
FBDCC60D1FABFE6A00E3184D /* SKViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBDCC60C1FABFE6A00E3184D /* SKViewController.swift */; };
|
||||
FBDCC6401FAC2CD900E3184D /* art.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = FBDCC63F1FAC2CD900E3184D /* art.scnassets */; };
|
||||
FBE134BA1FAAD3DD00BEC469 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBE134B91FAAD3DD00BEC469 /* AppDelegate.swift */; };
|
||||
FBE134BC1FAAD3DD00BEC469 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBE134BB1FAAD3DD00BEC469 /* ViewController.swift */; };
|
||||
FBE134BC1FAAD3DD00BEC469 /* SCNViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBE134BB1FAAD3DD00BEC469 /* SCNViewController.swift */; };
|
||||
FBE134BF1FAAD3DD00BEC469 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FBE134BD1FAAD3DD00BEC469 /* Main.storyboard */; };
|
||||
FBE134C11FAAD3DD00BEC469 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FBE134C01FAAD3DD00BEC469 /* Assets.xcassets */; };
|
||||
FBE134C41FAAD3DD00BEC469 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FBE134C21FAAD3DD00BEC469 /* LaunchScreen.storyboard */; };
|
||||
@@ -37,6 +38,7 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
FB2E368B1FAE2A510035B8D6 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
|
||||
FB9B5D2D1FC49E3E005DDD60 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
|
||||
FBD3F1E51FB260B000327054 /* ARVideoKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ARVideoKit.framework; path = Framework/ARVideoKit.framework; sourceTree = "<group>"; };
|
||||
FBDCC5E51FABDFC500E3184D /* Scene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Scene.sks; sourceTree = "<group>"; };
|
||||
FBDCC5E61FABDFC500E3184D /* Scene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scene.swift; sourceTree = "<group>"; };
|
||||
@@ -44,7 +46,7 @@
|
||||
FBDCC63F1FAC2CD900E3184D /* art.scnassets */ = {isa = PBXFileReference; lastKnownFileType = wrapper.scnassets; path = art.scnassets; sourceTree = "<group>"; };
|
||||
FBE134B61FAAD3DD00BEC469 /* ARVideoKit-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ARVideoKit-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FBE134B91FAAD3DD00BEC469 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
FBE134BB1FAAD3DD00BEC469 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
FBE134BB1FAAD3DD00BEC469 /* SCNViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SCNViewController.swift; sourceTree = "<group>"; };
|
||||
FBE134BE1FAAD3DD00BEC469 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
FBE134C01FAAD3DD00BEC469 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
FBE134C31FAAD3DD00BEC469 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
@@ -92,7 +94,8 @@
|
||||
FBA0AA0D1FAD9E4B006C481B /* View Controllers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FBE134BB1FAAD3DD00BEC469 /* ViewController.swift */,
|
||||
FB9B5D2D1FC49E3E005DDD60 /* MainViewController.swift */,
|
||||
FBE134BB1FAAD3DD00BEC469 /* SCNViewController.swift */,
|
||||
FBDCC60C1FABFE6A00E3184D /* SKViewController.swift */,
|
||||
);
|
||||
path = "View Controllers";
|
||||
@@ -230,10 +233,11 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FBE134BC1FAAD3DD00BEC469 /* ViewController.swift in Sources */,
|
||||
FBE134BC1FAAD3DD00BEC469 /* SCNViewController.swift in Sources */,
|
||||
FBE134BA1FAAD3DD00BEC469 /* AppDelegate.swift in Sources */,
|
||||
FBDCC60D1FABFE6A00E3184D /* SKViewController.swift in Sources */,
|
||||
FBDCC5E81FABDFC600E3184D /* Scene.swift in Sources */,
|
||||
FB9B5D2E1FC49E3E005DDD60 /* MainViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -371,7 +375,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = TB37P94YA8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
@@ -392,7 +396,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = TB37P94YA8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="N8h-YD-r0X">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
@@ -8,11 +8,79 @@
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
<array key="Avenir.ttc">
|
||||
<string>Avenir-Black</string>
|
||||
<string>Avenir-Medium</string>
|
||||
</array>
|
||||
</customFonts>
|
||||
<scenes>
|
||||
<!--Main View Controller-->
|
||||
<scene sceneID="wdx-bS-4nS">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="mainView" useStoryboardIdentifierAsRestorationIdentifier="YES" id="N8h-YD-r0X" customClass="MainViewController" customModule="ARVideoKit_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="lKA-5t-IIG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Try" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="khu-YU-VZr">
|
||||
<rect key="frame" x="8" y="63" width="359" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" name="Avenir-Black" family="Avenir" pointSize="40"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Framework features on" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eEa-da-nmU">
|
||||
<rect key="frame" x="8" y="183" width="359" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="27"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="ARVideoKit" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HUS-U8-CBt">
|
||||
<rect key="frame" x="8" y="131" width="359" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="41"/>
|
||||
<color key="textColor" red="0.97052964239999995" green="0.37927614589999997" blue="0.45678941579999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tQf-dN-lB4">
|
||||
<rect key="frame" x="8" y="268" width="359" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="18"/>
|
||||
<state key="normal" title=" AR SpriteKit App"/>
|
||||
<connections>
|
||||
<segue destination="7Ze-pj-Xqd" kind="show" id="93E-6x-10b"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="21A-pg-4R6">
|
||||
<rect key="frame" x="8" y="359" width="359" height="60"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="18"/>
|
||||
<state key="normal" title=" AR SceneKit App"/>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="show" id="aHU-mz-b0b"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="2zo-8C-5Jz"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="scnBtn" destination="21A-pg-4R6" id="TOp-ks-rLN"/>
|
||||
<outlet property="skBtn" destination="tQf-dN-lB4" id="Zfs-NO-PMo"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bSs-NK-rzw" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-724" y="454"/>
|
||||
</scene>
|
||||
<!--SCNViewController-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="scnView" title="SCNViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BYZ-38-t0r" customClass="ViewController" customModule="ARVideoKit_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController storyboardIdentifier="scnView" title="SCNViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BYZ-38-t0r" customClass="SCNViewController" customModule="ARVideoKit_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"/>
|
||||
@@ -121,23 +189,23 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="69u-dy-9On">
|
||||
<rect key="frame" x="294" y="20" width="65" height="65"/>
|
||||
<rect key="frame" x="7" y="20" width="65" height="65"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="65" id="3Xy-JT-6ZT"/>
|
||||
<constraint firstAttribute="height" constant="65" id="Q5O-CD-1T4"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="65" id="IPA-eO-hiu"/>
|
||||
<constraint firstAttribute="height" constant="65" id="jVv-es-uhg"/>
|
||||
</constraints>
|
||||
<size key="titleShadowOffset" width="0.0" height="1"/>
|
||||
<state key="normal" title="Go to SK">
|
||||
<state key="normal" title="Go Back">
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.65000000000000002" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<segue destination="7Ze-pj-Xqd" kind="show" id="x6e-M6-jfv"/>
|
||||
<action selector="goBack:" destination="BYZ-38-t0r" eventType="touchUpInside" id="93X-Zy-W33"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="69u-dy-9On" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="28v-Xd-AVo"/>
|
||||
<constraint firstItem="69u-dy-9On" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="7" id="0m6-4F-0Fh"/>
|
||||
<constraint firstItem="IMN-9B-haO" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" id="4lt-V9-t2E"/>
|
||||
<constraint firstItem="VIM-JP-UzO" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="55A-z8-Ex1"/>
|
||||
<constraint firstItem="DJd-jZ-eqw" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="8OL-Px-2eA"/>
|
||||
@@ -154,14 +222,14 @@
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="Sdu-XX-UpW" secondAttribute="trailing" constant="16" id="a7G-NE-FuY"/>
|
||||
<constraint firstItem="1R6-Xa-VsB" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="aDC-0U-rEb"/>
|
||||
<constraint firstItem="IMN-9B-haO" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="awb-Ub-ogs"/>
|
||||
<constraint firstItem="69u-dy-9On" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="bIZ-at-yZb"/>
|
||||
<constraint firstItem="p4z-aP-wTO" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="eIW-wL-nut"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="69u-dy-9On" secondAttribute="trailing" constant="16" id="fGZ-LP-ClO"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="1R6-Xa-VsB" secondAttribute="bottom" constant="20" id="g6C-dt-mSp"/>
|
||||
<constraint firstItem="1R6-Xa-VsB" firstAttribute="top" secondItem="p4z-aP-wTO" secondAttribute="bottom" constant="8" id="gd7-UD-shK"/>
|
||||
<constraint firstItem="DJd-jZ-eqw" firstAttribute="bottom" secondItem="VIM-JP-UzO" secondAttribute="bottom" constant="73" id="oes-gl-dgB"/>
|
||||
<constraint firstItem="69u-dy-9On" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="puT-8M-YHI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VIM-JP-UzO" secondAttribute="trailing" constant="294" id="shb-pG-gjl"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="pCi-Bx-pwj" secondAttribute="trailing" constant="16" id="shk-Bc-iV7"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="69u-dy-9On" secondAttribute="trailing" constant="20" symbolic="YES" id="veA-fi-fX6"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
@@ -174,7 +242,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53.600000000000001" y="133.5832083958021"/>
|
||||
<point key="canvasLocation" x="54" y="866"/>
|
||||
</scene>
|
||||
<!--SKViewController-->
|
||||
<scene sceneID="emy-Ex-RPU">
|
||||
@@ -341,7 +409,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="9if-am-XF6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="730" y="134"/>
|
||||
<point key="canvasLocation" x="54" y="134"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// MainViewController.swift
|
||||
// ARVideoKit-Example
|
||||
//
|
||||
// Created by Ahmed Bekhit on 11/21/17.
|
||||
// Copyright © 2017 Ahmed Fathi Bekhit. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MainViewController: UIViewController {
|
||||
|
||||
@IBOutlet var skBtn: UIButton!
|
||||
@IBOutlet var scnBtn: UIButton!
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
skBtn.layer.cornerRadius = skBtn.bounds.height/2
|
||||
scnBtn.layer.cornerRadius = scnBtn.bounds.height/2
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
}
|
||||
+45
-26
@@ -11,12 +11,15 @@ import ARKit
|
||||
import ARVideoKit
|
||||
import Photos
|
||||
|
||||
class ViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, RecordARDelegate {
|
||||
class SCNViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, RecordARDelegate {
|
||||
|
||||
@IBOutlet var sceneView: ARSCNView!
|
||||
@IBOutlet var recordBtn: UIButton!
|
||||
@IBOutlet var pauseBtn: UIButton!
|
||||
|
||||
let recordingQueue = DispatchQueue(label: "recordingThread", attributes: .concurrent)
|
||||
let caprturingQueue = DispatchQueue(label: "capturingThread", attributes: .concurrent)
|
||||
|
||||
var recorder:RecordAR?
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -46,7 +49,7 @@ class ViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, Rec
|
||||
recorder?.renderAR = self
|
||||
|
||||
// Configure the renderer to perform additional image & video processing 👁
|
||||
//recorder?.onlyRenderWhileRecording = false
|
||||
recorder?.onlyRenderWhileRecording = false
|
||||
|
||||
// Configure ARKit content mode. Default is .auto
|
||||
//recorder?.contentMode = .aspectFit
|
||||
@@ -75,6 +78,12 @@ class ViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, Rec
|
||||
// Pause the view's session
|
||||
sceneView.session.pause()
|
||||
|
||||
if recorder?.status == .recording {
|
||||
recorder?.stopAndExport()
|
||||
}
|
||||
recorder?.onlyRenderWhileRecording = true
|
||||
recorder?.prepare(ARWorldTrackingConfiguration())
|
||||
|
||||
// Switch off the orientation lock for UIViewControllers with AR Scenes
|
||||
recorder?.rest()
|
||||
}
|
||||
@@ -89,7 +98,7 @@ class ViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, Rec
|
||||
override var prefersStatusBarHidden: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Exported UIAlert present method
|
||||
func exportMessage(success: Bool, status:PHAuthorizationStatus) {
|
||||
if success {
|
||||
@@ -125,13 +134,17 @@ class ViewController: UIViewController, ARSCNViewDelegate, RenderARDelegate, Rec
|
||||
}
|
||||
|
||||
//MARK: - Button Action Methods
|
||||
extension ViewController {
|
||||
extension SCNViewController {
|
||||
@IBAction func goBack(_ sender: UIButton) {
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@IBAction func capture(_ sender: UIButton) {
|
||||
if sender.tag == 0 {
|
||||
//Photo
|
||||
if recorder?.status == .readyToRecord {
|
||||
let image = recorder?.photo()
|
||||
recorder?.export(UIImage: image) { saved, status in
|
||||
let image = self.recorder?.photo()
|
||||
self.recorder?.export(UIImage: image) { saved, status in
|
||||
if saved {
|
||||
// Inform user photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status)
|
||||
@@ -141,16 +154,18 @@ extension ViewController {
|
||||
}else if sender.tag == 1 {
|
||||
//Live Photo
|
||||
if recorder?.status == .readyToRecord {
|
||||
recorder?.livePhoto(export: true) { ready, photo, status, saved in
|
||||
/*
|
||||
if ready {
|
||||
// Do something with the `photo` (PHLivePhotoPlus)
|
||||
}
|
||||
*/
|
||||
|
||||
if saved {
|
||||
// Inform user Live Photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status!)
|
||||
caprturingQueue.async {
|
||||
self.recorder?.livePhoto(export: true) { ready, photo, status, saved in
|
||||
/*
|
||||
if ready {
|
||||
// Do something with the `photo` (PHLivePhotoPlus)
|
||||
}
|
||||
*/
|
||||
|
||||
if saved {
|
||||
// Inform user Live Photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +195,9 @@ extension ViewController {
|
||||
sender.setTitle("Stop", for: .normal)
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
pauseBtn.isEnabled = true
|
||||
recorder?.record()
|
||||
recordingQueue.async {
|
||||
self.recorder?.record()
|
||||
}
|
||||
}else if recorder?.status == .recording {
|
||||
sender.setTitle("Record", for: .normal)
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
@@ -200,14 +217,16 @@ extension ViewController {
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
pauseBtn.isEnabled = false
|
||||
recordBtn.isEnabled = false
|
||||
recorder?.record(forDuration: 10) { path in
|
||||
self.recorder?.export(video: path) { saved, status in
|
||||
DispatchQueue.main.sync {
|
||||
sender.setTitle("w/Duration", for: .normal)
|
||||
self.pauseBtn.setTitle("Pause", for: .normal)
|
||||
self.pauseBtn.isEnabled = false
|
||||
self.recordBtn.isEnabled = true
|
||||
self.exportMessage(success: saved, status: status)
|
||||
recordingQueue.async {
|
||||
self.recorder?.record(forDuration: 10) { path in
|
||||
self.recorder?.export(video: path) { saved, status in
|
||||
DispatchQueue.main.sync {
|
||||
sender.setTitle("w/Duration", for: .normal)
|
||||
self.pauseBtn.setTitle("Pause", for: .normal)
|
||||
self.pauseBtn.isEnabled = false
|
||||
self.recordBtn.isEnabled = true
|
||||
self.exportMessage(success: saved, status: status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,7 +257,7 @@ extension ViewController {
|
||||
}
|
||||
|
||||
//MARK: - ARVideoKit Delegate Methods
|
||||
extension ViewController {
|
||||
extension SCNViewController {
|
||||
func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) {
|
||||
// Do some image/video processing.
|
||||
}
|
||||
@@ -17,6 +17,9 @@ class SKViewController: UIViewController, ARSKViewDelegate, RenderARDelegate, Re
|
||||
@IBOutlet var recordBtn: UIButton!
|
||||
@IBOutlet var pauseBtn: UIButton!
|
||||
|
||||
let recordingQueue = DispatchQueue(label: "recordingThread")
|
||||
let caprturingQueue = DispatchQueue(label: "capturingThread", attributes: .concurrent)
|
||||
|
||||
var recorder:RecordAR?
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -46,7 +49,7 @@ class SKViewController: UIViewController, ARSKViewDelegate, RenderARDelegate, Re
|
||||
recorder?.renderAR = self
|
||||
|
||||
// Configure the renderer to perform additional image & video processing 👁
|
||||
//recorder?.onlyRenderWhileRecording = false
|
||||
recorder?.onlyRenderWhileRecording = false
|
||||
|
||||
// Set the UIViewController orientations
|
||||
recorder?.inputViewOrientations = [.landscapeLeft, .landscapeRight, .portrait]
|
||||
@@ -74,6 +77,12 @@ class SKViewController: UIViewController, ARSKViewDelegate, RenderARDelegate, Re
|
||||
// Pause the view's session
|
||||
SKSceneView.session.pause()
|
||||
|
||||
if recorder?.status == .recording {
|
||||
recorder?.stopAndExport()
|
||||
}
|
||||
recorder?.onlyRenderWhileRecording = true
|
||||
recorder?.prepare(ARWorldTrackingConfiguration())
|
||||
|
||||
// Switch off the orientation lock for UIViewControllers with AR Scenes
|
||||
recorder?.rest()
|
||||
}
|
||||
@@ -132,8 +141,8 @@ extension SKViewController {
|
||||
if sender.tag == 0 {
|
||||
//Photo
|
||||
if recorder?.status == .readyToRecord {
|
||||
let image = recorder?.photo()
|
||||
recorder?.export(UIImage: image) { saved, status in
|
||||
let image = self.recorder?.photo()
|
||||
self.recorder?.export(UIImage: image) { saved, status in
|
||||
if saved {
|
||||
// Inform user photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status)
|
||||
@@ -143,16 +152,18 @@ extension SKViewController {
|
||||
}else if sender.tag == 1 {
|
||||
//Live Photo
|
||||
if recorder?.status == .readyToRecord {
|
||||
recorder?.livePhoto(export: true) { ready, photo, status, saved in
|
||||
/*
|
||||
if ready {
|
||||
// Do something with the `photo` (PHLivePhotoPlus)
|
||||
}
|
||||
*/
|
||||
|
||||
if saved {
|
||||
// Inform user Live Photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status!)
|
||||
caprturingQueue.async {
|
||||
self.recorder?.livePhoto(export: true) { ready, photo, status, saved in
|
||||
/*
|
||||
if ready {
|
||||
// Do something with the `photo` (PHLivePhotoPlus)
|
||||
}
|
||||
*/
|
||||
|
||||
if saved {
|
||||
// Inform user Live Photo has exported successfully
|
||||
self.exportMessage(success: saved, status: status!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,7 +193,9 @@ extension SKViewController {
|
||||
sender.setTitle("Stop", for: .normal)
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
pauseBtn.isEnabled = true
|
||||
recorder?.record()
|
||||
recordingQueue.async {
|
||||
self.recorder?.record()
|
||||
}
|
||||
}else if recorder?.status == .recording {
|
||||
sender.setTitle("Record", for: .normal)
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
@@ -202,14 +215,16 @@ extension SKViewController {
|
||||
pauseBtn.setTitle("Pause", for: .normal)
|
||||
pauseBtn.isEnabled = false
|
||||
recordBtn.isEnabled = false
|
||||
recorder?.record(forDuration: 10) { path in
|
||||
self.recorder?.export(video: path) { saved, status in
|
||||
DispatchQueue.main.sync {
|
||||
sender.setTitle("w/Duration", for: .normal)
|
||||
self.pauseBtn.setTitle("Pause", for: .normal)
|
||||
self.pauseBtn.isEnabled = false
|
||||
self.recordBtn.isEnabled = true
|
||||
self.exportMessage(success: saved, status: status)
|
||||
recordingQueue.async {
|
||||
self.recorder?.record(forDuration: 10) { path in
|
||||
self.recorder?.export(video: path) { saved, status in
|
||||
DispatchQueue.main.sync {
|
||||
sender.setTitle("w/Duration", for: .normal)
|
||||
self.pauseBtn.setTitle("Pause", for: .normal)
|
||||
self.pauseBtn.isEnabled = false
|
||||
self.recordBtn.isEnabled = true
|
||||
self.exportMessage(success: saved, status: status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user