com.webos.service.mediarecorder

Note
This API has been available since API level 27.

API Summary

Provides an interface to record in a webOS device.

Overview of the API

NA

Methods

close

ACG: mediarecorder.operation
  • Added: API level 27

Description

Closes the recorder and releases all resources.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 710, 800-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/close '{"recorderId": 1234}'

Response:

{
    "returnValue": true
}

open

ACG: mediarecorder.operation
  • Added: API level 27

Description

Opens a new recorder. Returns a unique ID to the client that is used for subsequent operations to control the recorder.

Parameters

Name

Required

Type

Description

videoSrcOptionalString

Unique ID of the camera pipeline.

Note:

  • You must provide both "videoSrc" and "audioSrc", or either "videoSrc" or "audioSrc".
  • ID can be obtained using the com.webos.media/load() API.
audioSrcOptionalString

Name of the microphone device from which the audio data must be captured.

Note: 

  • You must provide both "videoSrc" and "audioSrc", or either "videoSrc" or "audioSrc".
  • Supports only one audio source (usb_mic0).
  • Audio recording alone is currently not supported, will be available in a future release.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
recorderIdOptionalNumber

Unique identifier to control the recorder.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 200, 210, 700-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example : Camera recording with audio

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/open '{"videoSource": "_sAMEt6vNxFRzav","audioSource": "usb_mic0"}'

Response:

{
    "returnValue": true,
    "recorderId": 1234
}

Example : Camera recording without audio

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/open '{"videoSource": "_sAMEt6vNxFRzav"}'

Response:

{
    "returnValue": true,
    "recorderId": 1234
}

setOutputFile

ACG: mediarecorder.operation
  • Added: API level 27

Description

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/.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

pathRequiredString

Absolute path to the directory where the recorded file must be saved.

Possible values are:

  • /media/internal/
  • /tmp/

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 400, 800, 900-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setOutputFile '{"recorderId": 1234,"path":"/media/internal/"}'

Response:

{
    "returnValue": true
}

setOutputFormat

ACG: mediarecorder.operation
  • Added: API level 27

Description

Sets the specified format to store the streaming data.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

formatRequiredString

Format in which data is stored.

Possible values are:

  • MPEG4

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 500, 510, 800-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/setOutputFormat '{"recorderId": 1234,"format":"MPEG4"}'

Response:

{
    "returnValue": true
}

start

ACG: mediarecorder.operation
  • Added: API level 27

Description

Starts recording.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 600, 800-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/start '{"recorderId": 1234}'

Response:

{
    "returnValue": true
}

stop

ACG: mediarecorder.operation
  • Added: API level 27

Description

Stops recording and saves the output to file.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 610, 800-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/stop '{"recorderId": 1234}'

Response:

{
    "returnValue": true
}

takeSnapshot

ACG: mediarecorder.operation
  • Added: API level 27

Description

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.

Parameters

Name

Required

Type

Description

recorderIdRequiredNumber

Unique ID of the recorder.

Note: ID is obtained by using the open() API.

pathRequiredString

Absolute path to the directory where the snapshot image must be saved.

Possible values are:

  • /media/internal/
  • /tmp/
formatRequiredString

Indicates the format of the snapshot image.

Possible values are:

  • JPEG

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true : Indicates that the operation was successful.
  • false : Indicates that the operation failed. Check the "errorCode" and "errorText" fields for details.
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

The reason for the failure of the operation.

Error Codes Reference

Error Code

Error Text

Error Description

100, 110, 300, 310, 400, 500, 510, 620, 800, 900-

Check details of the relevant error codes in the "API Error Codes Reference" table below.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediarecorder/takeSnapshot '{"recorderId": 1234,"path":"/media/internal/","format":"JPEG"}'

Response:

{
    "returnValue": true
}

API Error Codes Reference

Error Code

Error Text

Error Description

100JSON parsing error

There is an error during JSON parsing.

110JSON type error

Trying to access a JSON value with the incorrect data type.

200Source must be specified

Source not provided for recording action.

210Audio only recording is not supported

Audio recording alone is currently not supported, will be available in a future release.

300Recorder ID must be specified

Unique ID for the recorder not provided.

310Recorder ID is invalid

The provided recorder ID is not valid or does not exist.

400Path must be specified

Required path information is missing.

500Format must be specified

Required format information is missing.

510Unsupported format

The format is not supported.

600Failed to start recording

Attempt to begin recording process has failed.

610Failed to stop recording

Unsuccessful in stopping an ongoing recording.

620Snapshot capture failed

Snapshot attempt was not successful.

700Failed to open recorder

Opening the recorder was unsuccessful or encountered an error.

710Failed to close recorder

Closing the recorder was unsuccessful or encountered an error.

800Invalid state

The recorder is not in the appropriate state to perform the action.

900Cannot write at specified location

Cannot save or write data at the specified location.

Contents