Table Of Contents

Previous topic

Recorder Prefab

Next topic

RenderCameraBaseBehaviour Class

RecorderBaseBehaviour Class

Description

RecorderBaseBehaviour is the component to control screen recording.

Public Types

enum Status{OnStarted, OnStopped, FailedToStart, FileSucceeded, FileFailed, LogInfo, LogError}
enum RecorderZoomMode{NoZoomAndClip, ZoomInWithAllContent}
enum RecorderProfile{Quality_1080P_Low, Quality_1080P_Middle, Quality_1080P_High, Quality_720P_Low, Quality_720P_Middle, Quality_720P_High, Quality_480P_Low, Quality_480P_Middle, Quality_480P_High, Quality_Default}

Public Fields

bool RequestPlatformPermission
RecorderProfile Profile
RecorderZoomMode Mode

Public Properties

string OutputFile

Public Functions

void StartRecording()
void StopRecording()
bool RecordFrame(RenderTexture texture)

Public Events

event Action<RecorderBaseBehaviour, RenderTexture> FrameUpdate
event Action<RecorderBaseBehaviour, Status, string> StatusUpdate

Overwritten MonoBahaviour Functions

protected virtual void OnDestroy()
protected virtual void Start()
protected virtual void Update()

enum Status

Constant Value Description
OnStarted 0x00000002 recording start
OnStopped 0x00000004 recording stopped
FailedToStart 0x00000202 start fail
FileSucceeded 0x00000400 file write succeed
FileFailed 0x00000401 file write fail
LogInfo 0x00000800 runtime info with description
LogError 0x00001000 runtime error with description

enum RecorderZoomMode

Constant Value Description
NoZoomAndClip 0x00000000 If output aspect ratio does not fit input, content will be clipped to fit output aspect ratio.
ZoomInWithAllContent 0x00000001 If output aspect ratio does not fit input, content will not be clipped and there will be black borders in one dimension.

enum RecorderProfile

Constant Value Description
Quality_1080P_Low 0x00000001 1080P, low quality
Quality_1080P_Middle 0x00000002 1080P, middle quality
Quality_1080P_High 0x00000004 1080P, high quality
Quality_720P_Low 0x00000008 720P, low quality
Quality_720P_Middle 0x00000010 720P, middle quality
Quality_720P_High 0x00000020 720P, high quality
Quality_480P_Low 0x00000040 480P, low quality
Quality_480P_Middle 0x00000080 480P, middle quality
Quality_480P_High 0x00000100 480P, high quality
Quality_Default 0x00000010 default resolution and quality, same as Quality_720P_Middle

bool RequestPlatformPermission

Request platform permission for device needed when start recording. If false, you have to make sure to request the permission by yourself.

Default value is true.

RecorderProfile Profile

Recorder profile. Changes will take effect after StartRecording.

Default value is Quality_720P_Middle.

RecorderZoomMode Mode

Zoom mode. Changes will take effect after StartRecording.

Default value is NoZoomAndClip.

string OutputFile

Recording output file. Changes will take effect after StartRecording. Must be set before StartRecording.

void StartRecording()

Start screen recording.

void StopRecording()

Stop screen recording.

bool RecordFrame(RenderTexture texture)

Record current data of the input texture. It should be called each draw to record after StartRecording.

event Action<RecorderBaseBehaviour, RenderTexture> FrameUpdate

Event for a frame update. It is called just before the texture is send for recording. You can change the texture in the event.

event Action<RecorderBaseBehaviour, Status, string> StatusUpdate

Event for status update. It can be used to check if the recording has stopped and if the output file is successfully saved.