Class Recorder
- Namespace
- easyar
The Recorder implements screen recording functionality for the current rendering environment. Currently, the Recorder only works on Android (4.3 or newer) and iOS with OpenGL ES 3.0 environment. Due to its dependency 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 If Unity uses the Multi-threaded rendering feature, the script thread will be separated from the rendering thread, and updateFrame cannot be called on the rendering thread. Therefore, if you need to use the screen recording feature, you should disable the Multi-threaded rendering feature. When using Android, you need to add the android.permission.RECORD_AUDIO permission declaration in AndroidManifest.xml. When using iOS, you need to add the NSMicrophoneUsageDescription permission declaration in Info.plist.
Methods
isAvailable
Returns true only on Android 4.3 or newer 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 the system functions to apply for permissions by yourself. It is only effective on Android and iOS platforms. On other platforms, the behavior is to directly call the callback to notify that the permissions have been authorized. The 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 will wait for the file writing to complete and return the result of 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