Class Recorder
- Namespace
- easyar
Recorder implements screen recording functionality for the current rendering environment. Currently, Recorder only works on Android (4.3 or newer) and iOS under OpenGL ES 3.0 environments. Due to dependency on OpenGL ES, all functions of this class (except requestPermissions, including destructors) must be called in a single thread that contains the OpenGL ES context. Unity Only In Unity, if Multi-threaded rendering is enabled, the script thread will be separated from the rendering thread, making it impossible to call updateFrame on the rendering thread. Therefore, if you need to use screen recording, you should disable Multi-threaded rendering. On Android, you need to add the android.permission.RECORD_AUDIO permission declaration in AndroidManifest.xml. On iOS, you need to add the NSMicrophoneUsageDescription permission declaration in Info.plist.
Methods
isAvailable
Returns true only on Android 4.3 or above, or iOS platforms.
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
- 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 only effective on Android and iOS platforms; on other platforms, it directly calls the callback to notify that permissions are 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
callbackSchedulerCallbackSchedulerpermissionCallbackOptional<Action<PermissionStatus,String>>
Returns
- Void
create
Creates and initializes the screen recording functionality. The statusCallback will notify some status changes and 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
configRecorderConfigurationcallbackSchedulerCallbackSchedulerstatusCallbackOptional<Action<RecordStatus,>>
Returns
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
- Void
updateFrame
Records a frame of data using a 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
textureTextureIdwidthInt32heightInt32
Returns
- Void
stop
Stops screen recording. After calling stop, it waits for the file write to complete and returns whether the recording was successful.
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
- Boolean