Recorder Class¶
This type is an EasyAR Sense API in C#: Recorder . Some descriptions may not apply to Unity environment on this page.
This type is fully wrapped into Unity components: VideoRecorder . There is no need to use this type directly.
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.
On Android, it is required to add android.permission.RECORD_AUDIO to AndroidManifest.xml for use.
On iOS, it is required to add NSMicrophoneUsageDescription to Info.plist for use.
Methods¶
isAvailable¶
- C#
public static bool isAvailable()
Returns true only on Android 4.3 or later, or on iOS.
requestPermissions¶
- C#
public static void requestPermissions( CallbackScheduler callbackScheduler, Optional<Action< PermissionStatus , string>> permissionCallback)
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.
create¶
- C#
public static Recorder create( RecorderConfiguration config, CallbackScheduler callbackScheduler, Optional<Action< RecordStatus , string>> statusCallback)
Creates an instance and initialize recording. statusCallback will dispatch event of status change and corresponding log.
start¶
- C#
public virtual void start()
Start recording.
updateFrame¶
- C#
public virtual void updateFrame( TextureId texture, int width, int height)
Update and record a frame using texture data.
stop¶
- C#
public virtual bool stop()
Stop recording. When calling stop, it will wait for file write to end and returns whether recording is successful.