Comment on page
What You Should Know
NatCorder provides all recording functionality with implementations of a single interface:
IMediaRecorder. At the highest level, NatCorder works by encoding video and audio frames on-demand. As a result, recording always follows three steps:
The first step is to start a recording session by creating a recorder.
// These are the currently supported recorders
var gifRecorder = new GIFRecorder(...);
var mp4Recorder = new MP4Recorder(...);
var hevcRecorder = new HEVCRecorder(...);
var jpgRecorder = new JPGRecorder(...);
var wavRecorder = new WAVRecorder(...);
var webmRecorder = new WEBMRecorder(...);
There is no defined limit on the number of simultaneous recording sessions, but the actual limit will vary by device.
Once you have created a recorder, you will commit video and/or audio frames to the recorder.
// Say I have a texture
var texture = new Texture2D(...) or new WebCamTexture(...);
// I can commit its pixel data for recording
// So you can commit a byte array
var byteBuffer = new byte[...];
// Or an int array
var intBuffer = new int[...];
When committing audio frames, the recorder always expects a single precision floating point (
float) linear PCM sample buffer, interleaved by channel. You will use the
CommitSamplesmethod to commit audio frames.
var sampleBuffer = new float[...];
var path = await recorder.FinishWriting();
The recorder will finish its operations, cleanup any resources, then return a path to the recorded video.