VideoKitRecorder
class VideoKit.VideoKitRecorder : MonoBehaviour
This component manages recording videos. The component can be added to any game object in the scene.
One recorder component can only record one video at a time. To record multiple videos simultaneously, use multiple recorder components.
Format Settings
The recorder's format settings dictate what types of media can be recorded, and how the resulting recording is handled:
Specifying the Recording Format
The format
dictates what type of file gets recorded in a given recording session. Currently, the following formats are supported:
The MP4
and HEVC
formats are not supported on WebGL.
The WEBM
format is currently only supported on Android and WebGL.
Specifying the Recording Destination
The recorder destination
determines if and how recorded videos are saved after a recording is finished. The following destinations are supported:
Specifying the Recording Directory
When the recorder destination
includes Destination.Documents
, the destinationPathPrefix
property is used to control the subdirectory where recordings are saved.
When the destinationPathPrefix
is null
or empty, recordings are saved to the application's documents directory.
Specifying the Video Mode
The videoMode
defines how video frames will be recorded. The following video modes are supported:
The videoMode
is ignored when the recorder format
does not support recording video frames.
Specifying the Audio Mode
The audioMode
defines how audio frames will be recorded. The following audio modes are supported:
Recording (AudioListener | Microphone)
is not yet supported, but will be soon.
Video Settings
The video settings are used to configure the video stream of recordings.
These settings only have an effect when the format
supports recording video frames, and when the videoMode
is not VideoMode.None
.
Specifying the Video Resolution
The resolution
determines the video resolution of recorded videos or images. The following resolution presets are supported:
Resolutions are always specified in landscape format, meaning that the width
is always larger than the height
.
We recommend against recording at Screen
resolution because some devices have very high screen pixel density. Use 1920x1080
instead.
Specifying the Video Orientation
The orientation
determines whether the video is recorded in portrait or landscape. The following orientation modes are supported:
The orientation
property does not rotate the video. It simply determines whether the video is tall or wide.
Specifying the Video Aspect
The aspect
is used to modify the video resolution to have a desired aspect ratio. The following aspect modes are supported:
The aspect
can be used to ensure that the recording aspect ratio matches the screen aspect ratio. This is useful when recording in augmented reality apps.
The aspect
property only has an effect when the orientation
is set to OrientationMode.MatchScreen
.
Specifying the Recording Cameras
The cameras
property holds an array of game cameras to record in a given recording session.
The cameras
are only used when the video mode is set to VideoMode.Camera
.
Specifying the Recording Texture
The texture
property is used to record video frames from a Texture
.
The texture
is only used when the videoMode
is set to VideoMode.Texture
.
Specifying the Recording Camera Manager
The cameraManager
property is used to record video frames from a CameraDevice
.
The cameraManager
is only used when the videoMode
is set to VideoMode.CameraDevice
.
Audio Settings
The audio settings are used to configure the audio stream of recordings.
These settings only have an effect when the format
supports recording audio frames, and when the audioMode
is not VideoMode.None
.
Specifying the Recording Microphone
The audioDevice
is used to stream microphone audio that will then be recorded.
The audioDevice
is only used when the audio mode has the AudioMode.Microphone
flag set.
See the NatDevice documentation for more information on working with audio devices.
Checking the Recording State
The recording
property reports whether a recording is currently in progress.
Starting a Recording Session
A recording session is started by calling the StartRecording
method. This method can be invoked directly from UI elements:
Recorders can only record one video at a time. So calling this method when running
is true
will result in an error.
Stopping a Recording Session
A recording session is stopped by calling the StopRecording
method.
Similar to the StartRecording
method, this method can be invoked directly from UI elements.
When the recorder destination
is set to Documents
, the videos are saved to the VideoKit
folder in the app's private documents directory.
Calling StopRecording
when recording
is false
will log a warning and silently return.
Handling a Recording Session
The OnRecordingCompleted
event is raised when a recording session is completed. A completed session could either result in a successful recording or a failure. Refer to the MediaAsset
class for more information.
Last updated