Table of Contents

Class Recorder

Namespace
easyar

Recorder implements screen recording for the current rendering environment. The current Recorder works only on Android (4.3 or later) and in the OpenGL ES 3.0 environment on iOS. Because it depends on OpenGLES, all functions of this class (except requestPermissions, including the destructor) must be called in a single thread that contains an OpenGLES context. Unity Only In Unity, if Multi-threaded rendering is used, the script thread is separated from the rendering thread, and updateFrame cannot be called on the rendering thread. Therefore, if screen recording is needed, Multi-threaded rendering should be disabled. When used on Android, the android.permission.RECORD_AUDIO permission declaration must be added to AndroidManifest.xml. When used on iOS, the NSMicrophoneUsageDescription permission declaration must be added to Info.plist.

Recorder

Methods

isAvailable

Returns true only on Android 4.3 or later, or on iOS.

bool easyar_Recorder_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
+ (bool)isAvailable
public static func isAvailable() -> Bool
public static bool isAvailable()

Returns

Type Description
Boolean

requestPermissions

Requests the system permissions required for screen recording. You can choose to use this function or call system functions yourself to request permissions. It is valid only on Android and iOS. On other platforms, the behavior is to directly call the callback to notify that permission has been granted. This function should be called on the UI thread.

void easyar_Recorder_requestPermissions(easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromPermissionStatusAndString permissionCallback)
static void requestPermissions(std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(PermissionStatus, std::string)>> permissionCallback)
public static void requestPermissions(@Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromPermissionStatusAndString permissionCallback)
companion object fun requestPermissions(callbackScheduler: CallbackScheduler, permissionCallback: FunctorOfVoidFromPermissionStatusAndString?): Unit
+ (void)requestPermissions:(easyar_CallbackScheduler *)callbackScheduler permissionCallback:(void (^)(easyar_PermissionStatus status, NSString * value))permissionCallback
public static func requestPermissions(_ callbackScheduler: CallbackScheduler, _ permissionCallback: ((PermissionStatus, String) -> Void)?) -> Void
public static void requestPermissions(CallbackScheduler callbackScheduler, Optional<Action<PermissionStatus, string>> permissionCallback)

Parameters

Name Type Description
callbackScheduler CallbackScheduler
permissionCallback Optional<Action<PermissionStatus,String>>

Returns

Type Description
Void

create

Creates and initializes screen recording. The statusCallback callback reports some status changes and the corresponding logs.

void easyar_Recorder_create(easyar_RecorderConfiguration * config, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromRecordStatusAndString statusCallback, easyar_Recorder * * Return)
static std::shared_ptr<Recorder> create(std::shared_ptr<RecorderConfiguration> config, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(RecordStatus, std::string)>> statusCallback)
public static @Nonnull Recorder create(@Nonnull RecorderConfiguration config, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromRecordStatusAndString statusCallback)
companion object fun create(config: RecorderConfiguration, callbackScheduler: CallbackScheduler, statusCallback: FunctorOfVoidFromRecordStatusAndString?): Recorder
+ (easyar_Recorder *)create:(easyar_RecorderConfiguration *)config callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler statusCallback:(void (^)(easyar_RecordStatus status, NSString * value))statusCallback
public static func create(_ config: RecorderConfiguration, _ callbackScheduler: CallbackScheduler, _ statusCallback: ((RecordStatus, String) -> Void)?) throws -> Recorder
public static Recorder create(RecorderConfiguration config, CallbackScheduler callbackScheduler, Optional<Action<RecordStatus, string>> statusCallback)

Parameters

Name Type Description
config RecorderConfiguration
callbackScheduler CallbackScheduler
statusCallback Optional<Action<RecordStatus,>>

Returns

Type Description
Recorder

start

Starts screen recording.

void easyar_Recorder_start(easyar_Recorder * This)
void start()
public void start()
fun start(): Unit
- (void)start
public func start() -> Void
public virtual void start()

Returns

Type Description
Void

updateFrame

Records one frame of data using texture.

void easyar_Recorder_updateFrame(easyar_Recorder * This, easyar_TextureId * texture, int width, int height)
void updateFrame(std::shared_ptr<TextureId> texture, int width, int height)
public void updateFrame(@Nonnull TextureId texture, int width, int height)
fun updateFrame(texture: TextureId, width: Int, height: Int): Unit
- (void)updateFrame:(easyar_TextureId *)texture width:(int)width height:(int)height
public func updateFrame(_ texture: TextureId, _ width: Int32, _ height: Int32) -> Void
public virtual void updateFrame(TextureId texture, int width, int height)

Parameters

Name Type Description
texture TextureId
width Int32
height Int32

Returns

Type Description
Void

stop

Stops screen recording. After stop is called, it waits for file writing to finish and returns whether the recording succeeded.

bool easyar_Recorder_stop(easyar_Recorder * This)
bool stop()
public boolean stop()
fun stop(): Boolean
- (bool)stop
public func stop() -> Bool
public virtual bool stop()

Returns

Type Description
Boolean