NativeBindings
See ml_media_recorder.h for additional comments.
Inherits from:
MagicLeapNativeBindings
Public Methods
MLResult.Code MLMediaRecorderCreate
Create a new
public MLResult.Code MLMediaRecorderCreate(
out ulong outHandle
)
Parameters
Type | Name | Description |
---|---|---|
out ulong | outHandle |
MLResult.Code MLMediaRecorderDestroy
Destroy a MediaRecorder object.
public MLResult.Code MLMediaRecorderDestroy(
ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle |
MLResult.Code MLMediaRecorderGetInputSurface
Gets the input surface to record from when using SURFACE video source. May only be called after MLMediaRecorderPrepare. Frames rendered to the producer before MLMediaRecorderStart() is called will be discarded. When using an input surface, there are no accessible input buffers, as buffers are automatically passed from the other modules to this surface. The returned input surface can also be passed as a destination surface to - a video/mixed reality video capture session when calling MLCameraPrepareCapture(). Captured raw video frames will be consumed directly as input to an encoder without copying. Caller of this API should release the surface using #MLMediaRecorderReleaseInputSurface() on the Surface handle after usage.
public MLResult.Code MLMediaRecorderGetInputSurface(
ulong handle,
out ulong outInputSurfaceHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
out ulong | outInputSurfaceHandle |
MLResult.Code MLMediaRecorderGetMaxAmplitude
Returns the maximum absolute amplitude that was sampled since the last call to this method. Call this only after the MLMediaRecorderSetAudioSource().
public MLResult.Code MLMediaRecorderGetMaxAmplitude(
ulong handle,
out int MaxAmp
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
out int | MaxAmp |
MLResult.Code MLMediaRecorderPrepare
Prepares the recorder to begin capturing and encoding data for input mediaformat. This method must be called after setting up the desired audio and video sources, encoders, but before start().
public MLResult.Code MLMediaRecorderPrepare(
ulong handle,
ulong formatHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ulong | formatHandle |
MLResult.Code MLMediaRecorderReleaseInputSurface
Release the Surface that was returned by #MLMediaRecorderGetInputSurface.
public MLResult.Code MLMediaRecorderReleaseInputSurface(
ulong handle,
ulong inputSurfaceHandle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ulong | inputSurfaceHandle |
MLResult.Code MLMediaRecorderReset
Restarts the MediaRecorder to its idle state. After calling this method, you will have to configure it again as if it had just been constructed.
public MLResult.Code MLMediaRecorderReset(
ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle |
MLResult.Code MLMediaRecorderSetAudioEncoder
Sets the audio encoder to be used for recording. If this method is not called, the output file will not contain an audio track. Call this after MLMediaRecorderSetOutputFormat() and before MLMediaRecorderPrepare().
public MLResult.Code MLMediaRecorderSetAudioEncoder(
ulong handle,
AudioEncoder inAudioEncoder
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
AudioEncoder | inAudioEncoder | Available audio encoder formats |
MLResult.Code MLMediaRecorderSetAudioSource
Set MediaRecorder audio source. cannot be called twice (without calling MLMediaRecorderReset() in between) because it triggers internal initialization.
public MLResult.Code MLMediaRecorderSetAudioSource(
ulong handle,
AudioSource inAudioSource
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
AudioSource | inAudioSource | Audio source to put in the recorded media. |
MLResult.Code MLMediaRecorderSetEventCallbacks
Sets the MediaRecorderListener object that will receive MediaRecorder notifications.
public MLResult.Code MLMediaRecorderSetEventCallbacks(
ulong handle,
ref MLMediaRecorderEventCallbacks callbacks,
IntPtr data
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaRecorderEventCallbacks | callbacks | Comment Needed! |
IntPtr | data |
MLResult.Code MLMediaRecorderSetGeoLocation
Sets the GEO location for recording.
public MLResult.Code MLMediaRecorderSetGeoLocation(
ulong handle,
long inLatitude10000,
long inLongitude10000
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
long | inLatitude10000 | |
long | inLongitude10000 |
MLResult.Code MLMediaRecorderSetMaxDuration
Sets the maximum duration (in ms) of the recording session. Call this after MLMediaRecorderSetOutputFormat() and before MLMediaRecorderPrepare(). After recording reaches the specified duration, a notification will be sent via the callback with a MLMediaRecorderInfo code of MLMediaRecorderInfo_MaxDurationReached and recording will be stopped. Stopping happens asynchronously, there is no guarantee that the recorder will have stopped by the time the listener is notified.
public MLResult.Code MLMediaRecorderSetMaxDuration(
ulong handle,
int inMaxDurationMsec
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
int | inMaxDurationMsec |
MLResult.Code MLMediaRecorderSetMaxFileSize
Sets the maximum file size (in bytes) of the recording session.
public MLResult.Code MLMediaRecorderSetMaxFileSize(
ulong handle,
long inMaxFileSize
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
long | inMaxFileSize |
MLResult.Code MLMediaRecorderSetOutputFileForFD
Pass in the file descriptor of the file to be written. Call this after MLMediaRecorderSetOutputFormat() but before MLMediaRecorderprepare().
public MLResult.Code MLMediaRecorderSetOutputFileForFD(
ulong handle,
int Fd
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
int | Fd |
MLResult.Code MLMediaRecorderSetOutputFileForPath
Sets the path of the output file to be produced. Call this after MLMediaRecorderSetOutputFormat() but before MLMediaRecorder prepare().
public MLResult.Code MLMediaRecorderSetOutputFileForPath(
ulong handle,
string path
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
string | path |
MLResult.Code MLMediaRecorderSetOutputFormat
Sets the format of the output file produced during recording.
public MLResult.Code MLMediaRecorderSetOutputFormat(
ulong handle,
OutputFormat inFormat
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
OutputFormat | inFormat | Possible output formats |
MLResult.Code MLMediaRecorderSetVideoEncoder
Sets the video encoder to be used for recording. If this method is not called, the output file will not contain an video track. Call this after MLMediaRecorderSetOutputFormat() and before MLMediaRecorderPrepare(). The video source is always set to camera by default.
public MLResult.Code MLMediaRecorderSetVideoEncoder(
ulong handle,
VideoEncoder inVideoEncoder
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
VideoEncoder | inVideoEncoder | Available video encoder formats |
MLResult.Code MLMediaRecorderSetVideoSource
Sets MediaRecorder default video source. cannot be called twice (without calling MLMediaRecorderReset() in between) because it triggers internal initialization. Current implementation supports only camera as video source from
public MLResult.Code MLMediaRecorderSetVideoSource(
ulong handle,
VideoSource inVideoSource
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
VideoSource | inVideoSource | Video source to put in the recorded media. |
MLResult.Code MLMediaRecorderStart
Begins capturing and encoding data to the specified file. Call this after MLMediaRecorderPrepare(). The apps should not start another recording session during recording.
public MLResult.Code MLMediaRecorderStart(
ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle |
MLResult.Code MLMediaRecorderStop
Stops recording. Call this after MLMediaRecorderStart(). Once recording is stopped, you will have to configure it again as if it has just been constructed.
public MLResult.Code MLMediaRecorderStop(
ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle |
delegate void OnErrorDelegate
Callback whenever MediaRecorder received a general error message.
public delegate void OnErrorDelegate(
ulong handle,
ref MLMediaRecorderOnError error
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaRecorderOnError | error | When the error or info type is track specific, it has the following layout: The left-most 16-bit is meant for error or info type and the right-most 4-bit is meant for track id. |
delegate void OnInfoDelegate
Callback whenever MediaRecorder received a general info/warning message.
public delegate void OnInfoDelegate(
ulong handle,
ref MLMediaRecorderOnInfo info
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaRecorderOnInfo | info | When the error or info type is track specific, it has the following layout: The left-most 16-bit is meant for error or info type and the right-most 4-bit is meant for track id. |
delegate void OnTrackErrorDelegate
Callback whenever MediaRecorder received a track-related error message.
public delegate void OnTrackErrorDelegate(
ulong handle,
ref MLMediaRecorderOnError trackError
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaRecorderOnError | trackError | When the error or info type is track specific, it has the following layout: The left-most 16-bit is meant for error or info type and the right-most 4-bit is meant for track id. |
delegate void OnTrackInfoDelegate
Callback whenever MediaRecorder received a track-related info/warning message.
public delegate void OnTrackInfoDelegate(
ulong handle,
ref MLMediaRecorderOnInfo trackInfo
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | |
ref MLMediaRecorderOnInfo | trackInfo | When the error or info type is track specific, it has the following layout: The left-most 16-bit is meant for error or info type and the right-most 4-bit is meant for track id. |