Tizen Native API

The Recorder API provides functions for audio and video recording.

Required Header

#include <recorder.h>

Overview

The Recorder API provides functions to control the recording of a multimedia content. Simple audio and audio/video are supported. Recording operations operate as a state machine, described below.

In addition, the API contains functions to configure the recording process, or find details about it, such as getting/setting the filename for the recording, the file format and the video codec. Some of these interfaces are listed in the Recorder Attributes API.

Additional functions allow registering notifications via callback functions for various state change events.

State Diagram

capi_media_recorder_state_diagram.png

State Transitions

FUNCTION PRE-STATE POST-STATE SYNC TYPE
recorder_create_videorecorder()
recorder_create_audiorecorder()
NONE CREATED ASYNC
recorder_destroy() CREATED NONE ASYNC
recorder_prepare() CREATED READY ASYNC
recorder_unprepare() READY CREATED ASYNC
recorder_start() READY / PAUSED RECORDING ASYNC
recorder_pause() RECORDING PAUSED ASYNC
recorder_cancel()
recorder_commit()
RECORDING / PAUSED READY ASYNC

Callback(Event) Operations

The callback mechanism is used to notify the application about significant recorder events.

REGISTER UNREGISTER CALLBACK DESCRIPTION
recorder_set_recording_limit_reached_cb() recorder_unset_recording_limit_reached_cb() recorder_recording_limit_reached_cb() This callback is called when recording limitation error has occurred during recording.
recorder_set_recording_status_cb() recorder_unset_recording_status_cb() recorder_recording_status_cb() This callback is used to notify the recording status.
recorder_set_state_changed_cb() recorder_unset_state_changed_cb() recorder_state_changed_cb() This callback is used to notify the change of recorder's state.

Foreach Operations

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.

Functions

int recorder_create_videorecorder (camera_h camera, recorder_h *recorder)
 Creates a recorder handle to record a video.
int recorder_create_audiorecorder (recorder_h *recorder)
 Creates a recorder handle to record an audio.
int recorder_destroy (recorder_h recorder)
 Destroys the recorder handle.
int recorder_prepare (recorder_h recorder)
 Prepares the media recorder for recording.
int recorder_unprepare (recorder_h recorder)
 Resets the media recorder.
int recorder_start (recorder_h recorder)
 Starts the recording.
int recorder_pause (recorder_h recorder)
 Pauses the recording.
int recorder_commit (recorder_h recorder)
 Stops recording and saves the result.
int recorder_cancel (recorder_h recorder)
 Cancels the recording.
int recorder_get_state (recorder_h recorder, recorder_state_e *state)
 Gets the recorder's current state.
int recorder_get_audio_level (recorder_h recorder, double *dB)
 Gets the peak audio input level that was sampled since the last call to this function.
int recorder_set_filename (recorder_h recorder, const char *path)
 Sets the file path to record.
int recorder_get_filename (recorder_h recorder, char **path)
 Gets the file path to record.
int recorder_set_file_format (recorder_h recorder, recorder_file_format_e format)
 Sets the file format for recording media stream.
int recorder_get_file_format (recorder_h recorder, recorder_file_format_e *format)
 Gets the file format for recording media stream.
int recorder_set_audio_encoder (recorder_h recorder, recorder_audio_codec_e codec)
 Sets the audio codec for encoding an audio stream.
int recorder_get_audio_encoder (recorder_h recorder, recorder_audio_codec_e *codec)
 Gets the audio codec for encoding an audio stream.
int recorder_set_video_resolution (recorder_h recorder, int width, int height)
 Sets the resolution of the video recording.
int recorder_get_video_resolution (recorder_h recorder, int *width, int *height)
 Gets the resolution of the video recording.
int recorder_set_video_encoder (recorder_h recorder, recorder_video_codec_e codec)
 Sets the video codec for encoding video stream.
int recorder_get_video_encoder (recorder_h recorder, recorder_video_codec_e *codec)
 Gets the video codec for encoding video stream.
int recorder_set_state_changed_cb (recorder_h recorder, recorder_state_changed_cb callback, void *user_data)
 Registers the callback function that will be invoked when the recorder state changes.
int recorder_unset_state_changed_cb (recorder_h recorder)
 Unregisters the callback function.
int recorder_set_interrupted_cb (recorder_h recorder, recorder_interrupted_cb callback, void *user_data)
 Registers a callback function to be called when the media recorder is interrupted according to a policy.
int recorder_unset_interrupted_cb (recorder_h recorder)
 Unregisters the callback function.
int recorder_set_audio_stream_cb (recorder_h recorder, recorder_audio_stream_cb callback, void *user_data)
 Registers a callback function to be called when audio stream data is being delivered.
int recorder_unset_audio_stream_cb (recorder_h recorder)
 Unregisters the callback function.
int recorder_set_recording_status_cb (recorder_h recorder, recorder_recording_status_cb callback, void *user_data)
 Registers a callback function to be invoked when the recording information changes.
int recorder_unset_recording_status_cb (recorder_h recorder)
 Unregisters the callback function.
int recorder_set_recording_limit_reached_cb (recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data)
 Registers the callback function to be run when reached the recording limit.
int recorder_unset_recording_limit_reached_cb (recorder_h recorder)
 Unregisters the callback function.
int recorder_set_error_cb (recorder_h recorder, recorder_error_cb callback, void *user_data)
 Registers a callback function to be called when an asynchronous operation error occurred.
int recorder_unset_error_cb (recorder_h recorder)
 Unregisters the callback function.

Typedefs

typedef struct recorder_s * recorder_h
 The Media recorder handle.
typedef void(* recorder_recording_limit_reached_cb )(recorder_recording_limit_type_e type, void *user_data)
 Called when limitation error occurs while recording.
typedef void(* recorder_recording_status_cb )(unsigned long long elapsed_time, unsigned long long file_size, void *user_data)
 Called to indicate the recording status.
typedef void(* recorder_state_changed_cb )(recorder_state_e previous, recorder_state_e current, bool by_policy, void *user_data)
 Called when the record state is changed.
typedef void(* recorder_interrupted_cb )(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data)
 Called when the recorder is interrupted by a policy.
typedef void(* recorder_audio_stream_cb )(void *stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data)
 Called when audio stream data was being delivered just before storing in the recorded file.
typedef bool(* recorder_supported_video_resolution_cb )(int width, int height, void *user_data)
 Called once for each supported video resolution.
typedef void(* recorder_error_cb )(recorder_error_e error, recorder_state_e current_state, void *user_data)
 Called when the error occurred.

Typedef Documentation

typedef void(* recorder_audio_stream_cb)(void *stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data)

Called when audio stream data was being delivered just before storing in the recorded file.

Since :
2.3.1
Remarks:
The callback function holds the same buffer that will be recorded.
So if the user changes the buffer, the result file will contain the buffer.
The callback is called via internal thread of Frameworks, therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
Parameters:
[in]streamThe audio stream data
[in]sizeThe size of the stream data
[in]formatThe audio format
[in]channelThe number of the channel
[in]timestampThe timestamp of the stream buffer (in msec)
[in]user_dataThe user data passed from the callback registration function
See also:
recorder_set_audio_stream_cb()
typedef void(* recorder_error_cb)(recorder_error_e error, recorder_state_e current_state, void *user_data)

Called when the error occurred.

Since :
2.3.1
Remarks:
This callback informs about the critical error situation.
When being invoked, user should release the resource and terminate the application.
This error code will be reported. RECORDER_ERROR_DEVICE
RECORDER_ERROR_INVALID_OPERATION
RECORDER_ERROR_OUT_OF_MEMORY.
Parameters:
[in]errorThe error code
[in]current_stateThe current state of the recorder
[in]user_dataThe user data passed from the callback registration function
Precondition:
This callback function is invoked if you register this callback using recorder_set_error_cb().
See also:
recorder_set_error_cb()
recorder_unset_error_cb()
typedef struct recorder_s* recorder_h

The Media recorder handle.

Since :
2.3.1
typedef void(* recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data)

Called when the recorder is interrupted by a policy.

Since :
2.3.1
Parameters:
[in]policyThe policy that is interrupting the recorder
[in]previousThe previous state of the recorder
[in]currentThe current state of the recorder
[in]user_dataThe user data passed from the callback registration function
See also:
recorder_set_interrupted_cb()

Called when limitation error occurs while recording.

The callback function is possible to receive three types of limits: time, size and no-space.

Since :
2.3.1
Remarks:
After being called, recording data is discarded and not written in the recording file. Also the state of recorder is not changed.
Parameters:
[in]typeThe imitation type
[in]user_dataThe user data passed from the callback registration function
Precondition:
You have to register a callback using recorder_set_recording_limit_reached_cb().
See also:
recorder_set_recording_status_cb()
recorder_set_recording_limit_reached_cb()
recorder_unset_recording_limit_reached_cb()
typedef void(* recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data)

Called to indicate the recording status.

Since :
2.3.1
Remarks:
This callback function is repeatedly invoked during the RECORDER_STATE_RECORDING state.
Parameters:
[in]elapsed_timeThe time of the recording (milliseconds)
[in]file_sizeThe size of the recording file (KB)
[in]user_dataThe user data passed from the callback registration function
Precondition:
recorder_start() will invoke this callback if you register it using recorder_set_recording_status_cb().
See also:
recorder_set_recording_status_cb()
recorder_unset_recording_status_cb()
recorder_start()
typedef void(* recorder_state_changed_cb)(recorder_state_e previous, recorder_state_e current, bool by_policy, void *user_data)

Called when the record state is changed.

Since :
2.3.1
Parameters:
[in]previousThe previous state of the recorder
[in]currentThe current state of the recorder
[in]by_policytrue if the state is changed by policy, otherwise false if the state is not changed
[in]user_dataThe user data passed from the callback registration function
Precondition:
This function is required to register a callback using recorder_set_state_changed_cb().
See also:
recorder_set_state_changed_cb()
recorder_prepare()
recorder_unprepare()
recorder_start()
recorder_pause()
recorder_commit()
recorder_cancel()
typedef bool(* recorder_supported_video_resolution_cb)(int width, int height, void *user_data)

Called once for each supported video resolution.

Since :
2.3.1
Parameters:
[in]widthThe video image width
[in]heightThe video image height
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop,
otherwise false to break out of the loop
Precondition:
recorder_foreach_supported_video_resolution() will invoke this callback.
See also:
recorder_foreach_supported_video_resolution()

Enumeration Type Documentation

Enumeration for the audio codec.

Since :
2.3.1
Enumerator:
RECORDER_AUDIO_CODEC_DISABLE 

Disable audio track

RECORDER_AUDIO_CODEC_AMR 

AMR codec

RECORDER_AUDIO_CODEC_AAC 

AAC codec

RECORDER_AUDIO_CODEC_VORBIS 

Vorbis codec

RECORDER_AUDIO_CODEC_PCM 

PCM codec

Enumeration for audio capture devices.

Since :
2.3.1
Enumerator:
RECORDER_AUDIO_DEVICE_MIC 

Mic device

RECORDER_AUDIO_DEVICE_MODEM 

Modem

Enumeration for error code of the media recorder.

Since :
2.3.1
Enumerator:
RECORDER_ERROR_NONE 

Successful

RECORDER_ERROR_INVALID_PARAMETER 

Invalid parameter

RECORDER_ERROR_INVALID_STATE 

Invalid state

RECORDER_ERROR_OUT_OF_MEMORY 

Out of memory

RECORDER_ERROR_DEVICE 

Device error

RECORDER_ERROR_INVALID_OPERATION 

Internal error

RECORDER_ERROR_SOUND_POLICY 

Blocked by Audio Session Manager

RECORDER_ERROR_SECURITY_RESTRICTED 

Restricted by security system policy

RECORDER_ERROR_SOUND_POLICY_BY_CALL 

Blocked by Audio Session Manager - CALL

RECORDER_ERROR_SOUND_POLICY_BY_ALARM 

Blocked by Audio Session Manager - ALARM

RECORDER_ERROR_ESD 

ESD situation

RECORDER_ERROR_OUT_OF_STORAGE 

Out of storage

RECORDER_ERROR_PERMISSION_DENIED 

The access to the resources can not be granted

RECORDER_ERROR_NOT_SUPPORTED 

The feature is not supported

Enumeration for the file container format.

Since :
2.3.1
Enumerator:
RECORDER_FILE_FORMAT_3GP 

3GP file format

RECORDER_FILE_FORMAT_MP4 

MP4 file format

RECORDER_FILE_FORMAT_AMR 

AMR file format

RECORDER_FILE_FORMAT_ADTS 

ADTS file format

RECORDER_FILE_FORMAT_WAV 

WAV file format

RECORDER_FILE_FORMAT_OGG 

OGG file format

Enumeration for the recorder policy.

Since :
2.3.1
Enumerator:
RECORDER_POLICY_NONE 

None

RECORDER_POLICY_SOUND 

Sound policy

RECORDER_POLICY_SOUND_BY_CALL 

Sound policy by CALL

RECORDER_POLICY_SOUND_BY_ALARM 

Sound policy by ALARM

RECORDER_POLICY_SECURITY 

Security policy

Enumeration for the recording limit.

Since :
2.3.1
Enumerator:
RECORDER_RECORDING_LIMIT_TIME 

Time limit (second) of recording file

RECORDER_RECORDING_LIMIT_SIZE 

Size limit (kilo bytes [KB]) of recording file

RECORDER_RECORDING_LIMIT_FREE_SPACE 

No free space in storage

Enumeration for the recorder rotation type.

Since :
2.3.1
Enumerator:
RECORDER_ROTATION_NONE 

No rotation

RECORDER_ROTATION_90 

90 degree rotation

RECORDER_ROTATION_180 

180 degree rotation

RECORDER_ROTATION_270 

270 degree rotation

Enumeration for recorder states.

Since :
2.3.1
Enumerator:
RECORDER_STATE_NONE 

Recorder is not created

RECORDER_STATE_CREATED 

Recorder is created, but not prepared

RECORDER_STATE_READY 

Recorder is ready to record
In case of video recorder, preview display will be shown

RECORDER_STATE_RECORDING 

Recorder is recording media

RECORDER_STATE_PAUSED 

Recorder is paused while recording media

Enumeration for the video codec.

Since :
2.3.1
Enumerator:
RECORDER_VIDEO_CODEC_H263 

H263 codec

RECORDER_VIDEO_CODEC_H264 

H264 codec

RECORDER_VIDEO_CODEC_MPEG4 

MPEG4 codec

RECORDER_VIDEO_CODEC_THEORA 

Theora codec


Function Documentation

int recorder_cancel ( recorder_h  recorder)

Cancels the recording.

The recording data is discarded and not written in the recording file.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
When you want to record audio or video file, you need to add privilege according to rules below additionally.
If you want to save contents to internal storage, you should add mediastorage privilege.
If you want to save contents to external storage, you should add externalstorage privilege.
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_RECORDING set by recorder_start() or RECORDER_STATE_PAUSED by recorder_pause().
Postcondition:
The recorder state will be RECORDER_STATE_READY.
See also:
recorder_pause()
recorder_commit()
recorder_cancel()
recorder_start()
int recorder_commit ( recorder_h  recorder)

Stops recording and saves the result.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
When you want to record audio or video file, you need to add privilege according to rules below additionally.
If you want to save contents to internal storage, you should add mediastorage privilege.
If you want to save contents to external storage, you should add externalstorage privilege.
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_RECORDING set by recorder_start() or RECORDER_STATE_PAUSED by recorder_pause().
Postcondition:
The recorder state will be RECORDER_STATE_READY.
See also:
recorder_pause()
recorder_cancel()
recorder_set_filename()
recorder_start()

Creates a recorder handle to record an audio.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
You must release recorder using recorder_destroy().
Parameters:
[out]recorderA handle to the recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_OUT_OF_MEMORYOut of memory
RECORDER_ERROR_SOUND_POLICYSound policy error
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Postcondition:
The recorder state will be RECORDER_STATE_CREATED.
See also:
recorder_destroy()
int recorder_create_videorecorder ( camera_h  camera,
recorder_h recorder 
)

Creates a recorder handle to record a video.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
You must release recorder using recorder_destroy().
The camera handle also could be used for capturing images.
If the camera state was CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.
The created recorder state will be different according to camera state :
CAMERA_STATE_CREATED -> RECORDER_STATE_CREATED
CAMERA_STATE_PREVIEW -> RECORDER_STATE_READY
CAMERA_STATE_CAPTURED -> RECORDER_STATE_READY
Parameters:
[in]cameraThe handle to the camera
[out]recorderA handle to the recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_OUT_OF_MEMORYOut of memory
RECORDER_ERROR_SOUND_POLICYSound policy error
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
camera_create()
camera_stop_preview()
recorder_destroy()
int recorder_destroy ( recorder_h  recorder)

Destroys the recorder handle.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
The video recorder's camera handle is not released by this function.
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state should be RECORDER_STATE_CREATED.
Postcondition:
The recorder state will be RECORDER_STATE_NONE.
See also:
camera_destroy()
recorder_create_videorecorder()
recorder_create_audiorecorder()

Gets the audio codec for encoding an audio stream.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[out]codecThe audio codec
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_audio_encoder()
recorder_foreach_supported_audio_encoder()
int recorder_get_audio_level ( recorder_h  recorder,
double *  dB 
)

Gets the peak audio input level that was sampled since the last call to this function.

Since :
2.3.1
Remarks:
0 dB indicates maximum input level, -300 dB indicates minimum input level.
Parameters:
[in]recorderThe handle to the media recorder
[out]dBThe audio input level in dB
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_RECORDING or RECORDER_STATE_PAUSED.

Gets the file format for recording media stream.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[out]formatThe media file format
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_file_format()
recorder_foreach_supported_file_format()
int recorder_get_filename ( recorder_h  recorder,
char **  path 
)

Gets the file path to record.

Since :
2.3.1
Remarks:
You must release path using free().
Parameters:
[in]recorderThe handle to the media recorder
[out]pathThe recording file path
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_filename()
int recorder_get_state ( recorder_h  recorder,
recorder_state_e state 
)

Gets the recorder's current state.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[out]stateThe current state of the recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported

Gets the video codec for encoding video stream.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[out]codecThe video codec
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_video_encoder()
recorder_foreach_supported_video_encoder()
int recorder_get_video_resolution ( recorder_h  recorder,
int *  width,
int *  height 
)

Gets the resolution of the video recording.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[out]widthThe video width
[out]heightThe video height
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_video_resolution()
recorder_foreach_supported_video_resolution()
int recorder_pause ( recorder_h  recorder)

Pauses the recording.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
Recording can be resumed with recorder_start().
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_RECORDING.
Postcondition:
The recorder state will be RECORDER_STATE_PAUSED.
See also:
recorder_pause()
recorder_commit()
recorder_cancel()
int recorder_prepare ( recorder_h  recorder)

Prepares the media recorder for recording.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
Before calling the function, it is required to properly set audio encoder (recorder_set_audio_encoder()), video encoder(recorder_set_video_encoder()) and file format (recorder_set_file_format()).
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_SOUND_POLICYSound policy error
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state should be RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
Postcondition:
The recorder state will be RECORDER_STATE_READY.
If recorder handle is created by recorder_create_videorecorder(), the camera state will be changed to CAMERA_STATE_PREVIEW.
See also:
recorder_create_videorecorder()
recorder_create_audiorecorder()
recorder_unprepare()
recorder_set_audio_encoder()
recorder_set_video_encoder()
recorder_set_file_format()

Sets the audio codec for encoding an audio stream.

Since :
2.3.1
Remarks:
You can get available audio encoders by using recorder_foreach_supported_audio_encoder().
If set to RECORDER_AUDIO_CODEC_DISABLE, the audio track is not created in recording files.
Since 2.3.1, it could be returned RECORDER_ERROR_INVALID_OPERATION
when it's audio recorder and its state is RECORDER_STATE_READY
because of checking codec compatibility with current file format.
Parameters:
[in]recorderThe handle to the media recorder
[in]codecThe audio codec
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_INVALID_OPERATIONInvalid operation (Since 2.3.1)
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_get_audio_encoder()
recorder_foreach_supported_audio_encoder()
int recorder_set_audio_stream_cb ( recorder_h  recorder,
recorder_audio_stream_cb  callback,
void *  user_data 
)

Registers a callback function to be called when audio stream data is being delivered.

Since :
2.3.1
Remarks:
This callback function holds the same buffer that will be recorded.
Therefore if an user changes the buffer, the result file will have the buffer.
The callback is called via internal thread of Frameworks. Therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
This callback function to be called in RECORDER_STATE_RECORDING and RECORDER_STATE_PAUSED state.
Parameters:
[in]recorderThe handle to the recorder
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state should be RECORDER_STATE_READY or RECORDER_STATE_CREATED.
See also:
recorder_unset_audio_stream_cb()
recorder_audio_stream_cb()
int recorder_set_error_cb ( recorder_h  recorder,
recorder_error_cb  callback,
void *  user_data 
)

Registers a callback function to be called when an asynchronous operation error occurred.

Since :
2.3.1
Remarks:
This callback informs critical error situation.
When this callback is invoked, user should release the resource and terminate the application.
These error codes will occur.
RECORDER_ERROR_DEVICE
RECORDER_ERROR_INVALID_OPERATION
RECORDER_ERROR_OUT_OF_MEMORY
Parameters:
[in]recorderThe handle to the recorder
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Postcondition:
This function will invoke recorder_error_cb() when an asynchronous operation error occur.
See also:
recorder_unset_error_cb()
recorder_error_cb()

Sets the file format for recording media stream.

Since :
2.3.1
Remarks:
Since 2.3.1, it could be returned RECORDER_ERROR_INVALID_OPERATION
when it's audio recorder and its state is RECORDER_STATE_READY
because of checking codec compatibility with current encoder.
Parameters:
[in]recorderThe handle to the media recorder
[in]formatThe media file format
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_INVALID_OPERATIONInvalid operation (Since 2.3.1)
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY (for video recorder only).
Since 2.3.1, this API also works for audio recorder when its state is RECORDER_STATE_READY.
See also:
recorder_get_file_format()
recorder_foreach_supported_file_format()
int recorder_set_filename ( recorder_h  recorder,
const char *  path 
)

Sets the file path to record.

This function sets file path which defines where newly recorded data should be stored.

Since :
2.3.1
Remarks:
If the same file already exists in the file system, then old file will be overwritten.
Parameters:
[in]recorderThe handle to the media recorder
[in]pathThe recording file path
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_get_filename()
int recorder_set_interrupted_cb ( recorder_h  recorder,
recorder_interrupted_cb  callback,
void *  user_data 
)

Registers a callback function to be called when the media recorder is interrupted according to a policy.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_unset_interrupted_cb()
recorder_interrupted_cb()
int recorder_set_recording_limit_reached_cb ( recorder_h  recorder,
recorder_recording_limit_reached_cb  callback,
void *  user_data 
)

Registers the callback function to be run when reached the recording limit.

Since :
2.3.1
Parameters:
[in]recorderThe handle to media recorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Postcondition:
recorder_recording_limit_reached_cb() will be invoked.
See also:
recorder_unset_recording_limit_reached_cb()
recorder_attr_set_size_limit()
recorder_attr_set_time_limit()
recorder_recording_limit_reached_cb()
int recorder_set_recording_status_cb ( recorder_h  recorder,
recorder_recording_status_cb  callback,
void *  user_data 
)

Registers a callback function to be invoked when the recording information changes.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Postcondition:
recorder_recording_status_cb() will be invoked.
See also:
recorder_unset_recording_status_cb()
recorder_recording_status_cb()
int recorder_set_state_changed_cb ( recorder_h  recorder,
recorder_state_changed_cb  callback,
void *  user_data 
)

Registers the callback function that will be invoked when the recorder state changes.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Postcondition:
recorder_state_changed_cb() will be invoked.
See also:
recorder_unset_state_changed_cb()
recorder_state_changed_cb()

Sets the video codec for encoding video stream.

Since :
2.3.1
Remarks:
You can get available video encoders by using recorder_foreach_supported_video_encoder().
Parameters:
[in]recorderThe handle to the media recorder
[in]codecThe video codec
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_get_video_encoder()
recorder_foreach_supported_video_encoder()
int recorder_set_video_resolution ( recorder_h  recorder,
int  width,
int  height 
)

Sets the resolution of the video recording.

Since :
2.3.1
Remarks:
This function should be called before recording (recorder_start()).
Parameters:
[in]recorderThe handle to the media recorder
[in]widthThe preview width
[in]heightThe preview height
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_start()
recorder_get_video_resolution()
recorder_foreach_supported_video_resolution()
int recorder_start ( recorder_h  recorder)

Starts the recording.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
If file path has been set to an existing file, this file is removed automatically and updated by new one.
In the video recorder, some preview format does not support record mode. It will return RECORDER_ERROR_INVALID_OPERATION error.
You should use default preview format or CAMERA_PIXEL_FORMAT_NV12 in the record mode.
When you want to record audio or video file, you need to add privilege according to rules below additionally.
If you want to save contents to internal storage, you should add mediastorage privilege.
If you want to save contents to external storage, you should add externalstorage privilege.
The filename should be set before this function is invoked.
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state must be RECORDER_STATE_READY by recorder_prepare() or RECORDER_STATE_PAUSED by recorder_pause().
The filename should be set by recorder_set_filename().
Postcondition:
The recorder state will be RECORDER_STATE_RECORDING.
See also:
recorder_pause()
recorder_commit()
recorder_cancel()
recorder_set_audio_encoder()
recorder_set_filename()
recorder_set_file_format()
recorder_recording_status_cb()
recorder_set_filename()
int recorder_unprepare ( recorder_h  recorder)

Resets the media recorder.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_OPERATIONInvalid operation
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The recorder state should be RECORDER_STATE_READY set by recorder_prepare(), recorder_cancel() or recorder_commit().
Postcondition:
The recorder state will be RECORDER_STATE_CREATED.
If the recorder handle is created by recorder_create_videorecorder(), camera state will be changed to CAMERA_STATE_CREATED.
See also:
recorder_prepare()
recorder_cancel()
recorder_commit()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_audio_stream_cb()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the recorder
Returns:
on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_error_cb()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_interrupted_cb()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_recording_limit_reached_cb()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_recording_status_cb()

Unregisters the callback function.

Since :
2.3.1
Parameters:
[in]recorderThe handle to the media recorder
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_set_state_changed_cb()