Recorder Class¶
Description¶
Recorder implements recording for current rendering screen.
Currently Recorder only works on Android (4.3 or later) and iOS with OpenGL ES 2.0 context.
Due to the dependency to OpenGLES, every method in this class (except requestPermissions, including the destructor) has to be called in a single thread containing an OpenGLES context.
Unity Only If in Unity, Multi-threaded rendering is enabled, scripting thread and rendering thread will be two separate threads, which makes it impossible to call updateFrame in the rendering thread. For this reason, to use Recorder, Multi-threaded rendering option shall be disabled.
isAvailable¶
Returns true only on Android 4.3 or later, or on iOS.
- C: bool easyar_Recorder_isAvailable(void)¶
- C++17: static bool isAvailable()¶
- Traditional C++: static bool isAvailable()¶
- Java: public static boolean isAvailable()¶
- Kotlin: companion object fun isAvailable(): Boolean¶
- Objective-C: + (bool)isAvailable¶
- Swift: public static func isAvailable() -> Bool¶
- C#: public static bool isAvailable()¶
requestPermissions¶
Requests recording permissions from operating system. You can call this function or request permission directly from operating system. It is only available on Android and iOS. On other platforms, it will call the callback directly with status being granted. This function need to be called from the UI thread.
- C: void easyar_Recorder_requestPermissions(easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- Traditional C++: static void requestPermissions(CallbackScheduler * callbackScheduler, OptionalOfFunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- Java: public static void requestPermissions(@Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- Kotlin: companion object fun requestPermissions(callbackScheduler: CallbackScheduler, permissionCallback: FunctorOfVoidFromPermissionStatusAndString?): Unit¶
- Objective-C: + (void)requestPermissions:(easyar_CallbackScheduler *)callbackScheduler permissionCallback:(void (^)(easyar_PermissionStatus status, NSString * value))permissionCallback¶
- Swift: public static func requestPermissions(_ callbackScheduler: CallbackScheduler, _ permissionCallback: ((PermissionStatus, String) -> Void)?) -> Void¶
- C#: public static void requestPermissions(CallbackScheduler callbackScheduler, Optional<Action<PermissionStatus, string>> permissionCallback)¶
create¶
Creates an instance and initialize recording. statusCallback will dispatch event of status change and corresponding log.
- C: void easyar_Recorder_create(easyar_RecorderConfiguration * config, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromRecordStatusAndString statusCallback, easyar_Recorder * * Return)¶
- Traditional C++: static void create(RecorderConfiguration * config, CallbackScheduler * callbackScheduler, OptionalOfFunctorOfVoidFromRecordStatusAndString statusCallback, Recorder * * Return)¶
- Java: public static @Nonnull Recorder create(@Nonnull RecorderConfiguration config, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromRecordStatusAndString statusCallback)¶
- Kotlin: companion object fun create(config: RecorderConfiguration, callbackScheduler: CallbackScheduler, statusCallback: FunctorOfVoidFromRecordStatusAndString?): Recorder¶
- Objective-C: + (easyar_Recorder *)create:(easyar_RecorderConfiguration *)config callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler statusCallback:(void (^)(easyar_RecordStatus status, NSString * value))statusCallback¶
- Swift: public static func create(_ config: RecorderConfiguration, _ callbackScheduler: CallbackScheduler, _ statusCallback: ((RecordStatus, String) -> Void)?) -> Recorder¶
- C#: public static Recorder create(RecorderConfiguration config, CallbackScheduler callbackScheduler, Optional<Action<RecordStatus, string>> statusCallback)¶
start¶
Start recording.
- C: void easyar_Recorder_start(easyar_Recorder * This)¶
- C++17: void start()¶
- Traditional C++: void start()¶
- Java: public void start()¶
- Kotlin: fun start(): Unit¶
- Objective-C: - (void)start¶
- Swift: public func start() -> Void¶
- C#: public virtual void start()¶
updateFrame¶
Update and record a frame using texture data.
- C: void easyar_Recorder_updateFrame(easyar_Recorder * This, easyar_TextureId * texture, int width, int height)¶
- Traditional C++: void updateFrame(TextureId * texture, int width, int height)¶
- Java: public void updateFrame(@Nonnull TextureId texture, int width, int height)¶
- Kotlin: fun updateFrame(texture: TextureId, width: Int, height: Int): Unit¶
- Objective-C: - (void)updateFrame:(easyar_TextureId *)texture width:(int)width height:(int)height¶
- Swift: public func updateFrame(_ texture: TextureId, _ width: Int32, _ height: Int32) -> Void¶
- C#: public virtual void updateFrame(TextureId texture, int width, int height)¶
stop¶
Stop recording. When calling stop, it will wait for file write to end and returns whether recording is successful.
- C: bool easyar_Recorder_stop(easyar_Recorder * This)¶
- C++17: bool stop()¶
- Traditional C++: bool stop()¶
- Java: public boolean stop()¶
- Kotlin: fun stop(): Boolean¶
- Objective-C: - (bool)stop¶
- Swift: public func stop() -> Bool¶
- C#: public virtual bool stop()¶