RecordAR - AFathi/ARVideoKit GitHub Wiki
Class
RecordAR
RecordAR
is an ARView
sub-class that renders an ARSCNView
or ARSKView
content with the device's camera stream to generate a video πΉ, photo π, live photo π or GIF π.
Table of Contents | Description |
---|---|
Initialization | Initialize RecordAR with ARSCNView or ARSKView |
Delegate Configurations | Configure RecordARDelegate and RenderARDelegate |
Audio & Video Devices' Status | Check the media devices' current status |
Video Configurations | Configure video and renderer settings |
Audio Configurations | Configure audio settings |
Media File Configurations | Configure media files compression & caching |
Preparing Methods | Methods to setup RecordAR with the new configurations |
Capturing Methods | Methods to capture and record media content |
Exporting Methods | Methods to export capture or recorded media content |
Topics
Initialization
init
(ARSceneKit:ARSCNView)
Initializes ππ³ a new RecordAR
object with an ARSCNView
π.
init
(ARSpriteKit:ARSKView)
Initializes ππ³ a new RecordAR
object with an ARSKView
πΎ.
init
(SceneKit: SCNView)
Initializes ππ³ a new RecordAR
object with a SCNView
π².
Delegate Configurations
var
delegate
:RecordARDelegate
An object that passes the AR video recorder errors and status through the protocol methods.
var
renderAR
:RenderARDelegate
An object that passes the AR rendered content through the protocol method.
Audio & Video Devices' Status
var
status
:RecordARStatus
An object that returns the AR recorder current status.
var
micStatus
:RecordARMicrophoneStatus
An object that returns the current Microphone status.
var
requestMicPermission
:RecordARMicrophonePermission
An object that allow configuring when to ask for Microphone permission, if needed. Default is .manual
.
Video Configurations
var
fps
:ARVideoFrameRate
An object that allow customizing the video frame per second rate. Default is .auto
.
var
videoOrientation
:ARVideoOrientation
An object that allow customizing the video orientation. Default is .auto
.
var
contentMode
:ARFrameMode
An object that allow customizing the AR content mode. Default is .auto
.
var
onlyRenderWhileRecording
:Bool
A boolean that enables or disables AR content rendering before recording for image & video processing. Default is true
.
var
enableAdjustEnvironmentLighting
:Bool
A boolean that enables or disables using environment light rendering. Default is false
.
Audio Configurations
var
enableAudio
:Bool
A boolean that enables or disables audio recording. Default is true
.
var
enableMixWithOthers
:Bool
A boolean that enables or disables audio mixWithOthers
if audio recording is enabled. This allows playing music and recording audio at the same time. Default is true
.
Media File Configurations
var
adjustVideoForSharing
:Bool
A boolean that enables or disables adjusting captured media for sharing online. Default is true
.
var
adjustGIFForSharing
:Bool
A boolean that enables or disables adjusting captured GIFs for sharing online. Default is true
.
var
deleteCacheWhenExported
:Bool
A boolean that enables or disables clearing cached media after exporting to Camera Roll. Default is true
.
Preparing Methods
func
prepare(_ configuration:ARConfiguration)
A method that prepares the video recorder with ARConfiguration
π.
func
rest()
A method that switches off the orientation lock used in a UIViewController
that contains AR scenes ππ΄.
func
requestMicrophonePermission(_ finished: ((_ status: Bool) -> Swift.Void)? = nil)
A method that requsts microphone π permission manually, if requestMicPermission
is set to manual
.
Capturing Methods
func
photo() -> UIImage
A method that renders a photo π and returns it as UIImage
.
func
livePhoto(export:Bool, _ finished: ((_ status:Bool, _ livePhoto:PHLivePhotoPlus?, _ permissionStatus:PHAuthorizationStatus?, _ exported:Bool) -> Swift.Void)? = nil)
A method that renders a PHLivePhoto
π and returns PHLivePhotoPlus
in the completion handler.
func
gif(forDuration duration:TimeInterval, export:Bool, _ finished: ((_ status:Bool, _ gifPath: URL?, _ permissionStatus:PHAuthorizationStatus?, _ exported:Bool) -> Swift.Void)? = nil)
A method that renders a GIF π image and returns its local path (URL
) in the completion handler.
func
record()
A method that starts or resumes β― recording a video πΉ.
func
record(forDuration duration:TimeInterval, _ finished: ((_ videoPath: URL) -> Swift.Void)? = nil)
A method that starts recording a video πΉ with a specified duration β³ in seconds.
func
pause()
A method that pauses recording a video βΈπΉ. Use record() to resume.
func
stopAndExport(_ finished: ((_ videoPath: URL, _ permissionStatus:PHAuthorizationStatus, _ exported:Bool) -> Swift.Void)? = nil)
A method that stops βΉ recording a video πΉ and exports it to the Photo Library π²πΎ.
func
stop(_ finished:((_ videoPath: URL) -> Swift.Void)? = nil)
A method that stops βΉ recording a video πΉ and returns the video path in the completion handler.
Exporting Methods
func
export(video path:URL, _ finished: ((_ exported:Bool, _ permissionStatus:PHAuthorizationStatus)
A method that exports a video πΉ file path to the Photo Library π²πΎ.
func
export(image path:URL?=nil, UIImage:UIImage?=nil, _ finished: ((_ exported:Bool, _ permissionStatus:PHAuthorizationStatus) -> Swift.Void)? = nil)
A method that exports any image π/π (including gif, jpeg, and png) to the Photo Library π²πΎ.
func
export(live photo:PHLivePhotoPlus, _ finished: ((_ exported:Bool, _ permissionStatus:PHAuthorizationStatus)
A method that exports a PHLivePhotoPlus
π object to the Photo Library π²πΎ.