Skip to content
Ahmed Bekhit edited this page Jul 18, 2018 · 12 revisions

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

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 πŸ“πŸ˜΄.

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.

A method that renders a PHLivePhoto πŸŽ‡ and returns PHLivePhotoPlus in the completion handler.

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 πŸ“Ή.

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.

A method that stops ⏹ recording a video πŸ“Ή and exports it to the Photo Library πŸ“²πŸ’Ύ.

A method that stops ⏹ recording a video πŸ“Ή and returns the video path in the completion handler.

Exporting Methods

A method that exports a video πŸ“Ή file path to the Photo Library πŸ“²πŸ’Ύ.

A method that exports any image πŸŒ„/πŸŽ† (including gif, jpeg, and png) to the Photo Library πŸ“²πŸ’Ύ.

A method that exports a PHLivePhotoPlus πŸŽ‡ object to the Photo Library πŸ“²πŸ’Ύ.

Clone this wiki locally