Note
This API has been available since API level 27.
This API has been available since API level 27.
Provides an interface to record in a webOS device.
NA
API level 27
Closes the recorder and releases all resources.
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 710, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/close '{"recorderId": 1234}'
Response:
{
"returnValue": true
}
API level 27
Opens a new recorder.
Returns a unique ID to the client that is used for subsequent operations to control the recorder.
Name | Required | Type | Description |
---|---|---|---|
video | Optional | String | Indicates the unique ID of the camera. Note:
|
audio | Optional | Boolean | Enables audio recording. Note:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
recorderId | Optional | Number | Unique identifier to control the recorder. |
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 200, 210, 700 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example : Camera recording with audio
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/open '{"video": "camera1","audio": true}'
Response:
{
"returnValue": true,
"recorderId": 1234
}
Example : Camera recording without audio
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/open '{"video": "camera1"}'
Response:
{
"returnValue": true,
"recorderId": 1234
}
Example : Audio only recording
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/open '{"audio": true}'
Response:
{
"returnValue": true,
"recorderId": 1234
}
API level 29
Pauses recording.
Note: Call this API after start() but before stop() or resume().
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the methods 'Error Codes' section for details. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 630, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/pause '{"recorderId": 1234}'
Response:
{
"returnValue": true
}
API level 29
Resumes recording.
Note: Call this API after pause() but before stop().
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the methods 'Error Codes' section for details. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 640, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/resume '{"recorderId": 1234}'
Response:
{
"returnValue": true
}
API level 29
Sets the audio format.
Note: Call this API after open() but before start().
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
codec | Optional | String | Set the audio encoder to use for recording. Possible values are:
Note: Currently supports only AAC |
bitRate | Optional | Number | Set the audio encoding bitrate (in bits/s). Default : 0 (Automatically adjust bitrate) |
sampleRate | Optional | Number | Set the audio sample rate. Possible values are:
|
channelCount | Optional | Number | Set the number of audio channels Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the methods 'Error Codes' section for details. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 540, 730, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setAudioFormat '{
"recorderId": 1234,
"codec":"AAC",
"bitRate":192000,
"sampleRate":48000,
"channelCount":2
}'
Response:
{
"returnValue": true
}
API level 27
Sets the path to store the streaming data.
The default file name is of the format "RecordDDMMYYYY-HHMMSS", where DDMMYYYY-HHMMSS is current date and time.
Note: If not explicitly set by calling this method, the default path is /media/internal/.
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
path | Required | String | Absolute path to the directory where the recorded file must be saved. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 400, 800, 900 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setOutputFile '{"recorderId": 1234,"path":"/media/internal/"}'
Response:
{
"returnValue": true
}
API level 27
Sets the specified format to store the streaming data.
Note: Call this API after open() but before start().
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
format | Required | String | Format in which data is stored. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 500, 510, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setOutputFormat '{"recorderId": 1234,"format":"MP4"}'
Response:
{
"returnValue": true
}
API level 29
Sets the video format.
Note: Call this API after open() but before start().
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
codec | Optional | String | Set the audio encoder to use for recording. Possible values are:
Note: Currently supports only H264 |
bitRate | Optional | Number | Set the video encoding bitrate(in bits/s). Default value: 10000000 |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of the operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. See the methods 'Error Codes' section for details. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 530, 550, 720, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setVideoFormat '{
"recorderId": 1234,
"codec":"H264",
"bitRate":10000000
}'
Response:
{
"returnValue": true
}
API level 27
Starts recording.
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 600, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/start '{"recorderId": 1234}'
Response:
{
"returnValue": true
}
API level 27
Stops recording and saves the output to file.
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
path | Optional | String | Indicates the path and file names of the saved file. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 610, 800 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/stop '{"recorderId": 1234}'
<Record video and audio or record video only>
Response:
{
"returnValue": true,
"path": "/media/internal/Record03122023-17171504.mp4"
}
<Record audio only>
Response:
{
"returnValue": true,
"path": "/media/internal/Audio03122023-17174953.m4a"
}
API level 27
Takes one video snapshot during recording and save the image to a file.
The default file name is of the format "CaptureDDMMYYYY-HHMMSS", where DDMMYYYY-HHMMSS is current date and time.
Name | Required | Type | Description |
---|---|---|---|
recorderId | Required | Number | Unique ID of the recorder. Note: ID is obtained by using the open() API. |
path | Required | String | Absolute path to the directory where the snapshot image must be saved. Possible values are:
|
format | Required | String | Indicates the format of the snapshot image. Possible values are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
path | Optional | String | Indicates the path and file names of the saved file. |
Error Code | Error Text | Error Description |
---|---|---|
100, 110, 300, 310, 400, 500, 510, 620, 800, 900 | Depends on error code | Check details of the relevant error codes in the "API Error Codes Reference" table below. |
Example scenario
# luna-send -n 1 -f luna://com.webos.service.mediarecorder/takeSnapshot '{"recorderId": 1234,"path":"/media/internal/","format":"JPEG"}'
Response:
{
"returnValue": true,
"path": "/media/internal/Capture03122023-17173792.jpeg"
}
Error Code | Error Text | Error Description |
---|---|---|
100 | JSON parsing error | There is an error during JSON parsing. |
110 | JSON type error | Trying to access a JSON value with the incorrect data type. |
200 | Source must be specified | Source not provided for recording action. |
210 | Audio only recording is not supported | Audio recording alone is currently not supported, will be available in a future release. |
300 | Recorder ID must be specified | Unique ID for the recorder not provided. |
310 | Recorder ID is invalid | The provided recorder ID is not valid or does not exist. |
400 | Path must be specified | Required path information is missing. |
500 | Format must be specified | Required format information is missing. |
510 | Unsupported format | The format is not supported. |
520 | Failed to open camera | Attempt to open camera has failed. |
530 | Video bitrate is out of range | The bitrate of the video is not within the acceptable range. |
540 | Unsupported audio format | Unsupported audio format |
550 | Unsupported video format | Unsupported video format |
600 | Failed to start recording | Attempt to begin recording process has failed. |
610 | Failed to stop recording | Unsuccessful in stopping an ongoing recording. |
620 | Snapshot capture failed | Snapshot attempt was not successful. |
630 | Failed to pause | Attempted to pause recording, but failed. |
640 | Failed to resume | Attempted to resume recording, but failed. |
700 | Failed to open recorder | Opening the recorder was unsuccessful or encountered an error. |
710 | Failed to close recorder | Closing the recorder was unsuccessful or encountered an error. |
720 | Video is not opened | Occurs when you try to set the video format when the video is not open. |
730 | Audio is not opened | Occurs when you try to set the audio format when the audio is not open. |
800 | Invalid state | The recorder is not in the appropriate state to perform the action. |
900 | Cannot write at specified location | Cannot save or write data at the specified location. |
Contents