com.webos.service.mediacontroller

Note
This API has been available since API level 12.

API Summary

Provides features to handle the AVRCP events regardless of application type (web app/native app) in order to remotely control the playback and handles key events such as play, pause, next, previous, mute and unmute.

Overview of the API

Provides methods to manage media sessions and get metadata/playback status of the media and routes the AVRCP events received from the remote device to corresponding media client.

Methods

activateMediaSession

ACG: mediacontroller.query
  • Added: API level 12

Description

Activates the media session.

Recommended usage: The API is recommended to be used by the application.

Note:

  • Only an active media session can receive the AVRCP key events and forward them to the application.
  • To activate a media session, the client must subscribe to the mediaId using registerMediaSession() API.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to be activated.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/activateMediaSession '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true
}

deactivateMediaSession

ACG: mediacontroller.query
  • Added: API level 12

Description

Deactivates the media session.

Recommended usage: The API is recommended to be used by the application.

Note: After the media session is deactivated, the corresponding media client cannot receive AVRCP key events.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to be deactivated.

Call Returns

Name

Required

Type

Description

returnValueRequiredString

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/deactivateMediaSession '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true
}

getActiveMediaSessions

ACG: mediacontroller.operation
  • Added: API level 12

Description

Gets the list of all the active media sessions.

Recommended usage: The API is recommended to be used by the service.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
sessionListOptionalString array

Indicates the list of all active sessions registered with service.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/getActiveMediaSessions '{}'

Response:

{
   "returnValue":true,
   "sessionList":[
      "XCFRHKH",
      "NBFSIEOL"
   ]
}

getMediaCoverArtPath

ACG: None
  • Added: API level 30

Description

Downloads requested cover art URI and provides downloaded path.

Parameters

Name

Required

Type

Description

displayIdRequiredNumber

Display ID.

srcRequiredString array

Source URIs of cover art images.

subscribeOptionalBoolean

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed.
  • false (Default): Not subscribed.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the operation.

Possible values are:

  • true: Successful.
  • false: Not successful. See 'Error Codes' section for details.
coverArtPathInfoRequiredObject array: coverArtPathInfo

Provides cover art source and download path.

subscribedRequiredBoolean

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed.
  • false: Not subscribed.

Subscription Returns

Name

Required

Type

Description

srcRequiredString

Source URI of Requested downloaded cover Art image.

srcPathRequiredString

Provides cover art source and downloaded path.

returnValueRequiredBoolean

Indicates the status of the operation.

Possible values are:

  • true: Successful.
  • false: Not successful. Check the method's 'Error Codes' section for failure details (errorCode and/or errorText).
subscribedRequiredBoolean

Indicates if subscribe to get notifications.

Possible values are:

  • true: Subscribed.

Error Codes Reference

Error Code

Error Text

Error Description

2Check error details

For details of a specific error, see the 'API Error codes Reference' table.

Example

Example scenario

# luna-send -n 3 -f luna://com.webos.service.mediacontroller/getMediaCoverArtPath '{
    "displayId":0,
    "src":["https://storage.googleapis.com/media-session/sintel/artwork-128.png"],
    "subscribe":true
}'

Response:

{
    "subscribed": true,
    "returnValue": true,
    "coverArtPathInfo": [
        {
            "src": "https://storage.googleapis.com/media-session/sintel/artwork-128.png",
            "srcPath": "/media/internal/.media-session/artwork-128.png"
        }
    ]
}

Subscription : 

{
    "subscribed": true,
    "returnValue": true,
    "src": "https://storage.googleapis.com/media-session/sintel/artwork-128.png",
    "srcPath": "/media/internal/.media-session/artwork-128.png"
}

getMediaMetaData

ACG: mediacontroller.operation
  • Added: API level 12

Description

Requests metadata of the media session related to the given mediaId.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId for meta data information.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
metaDataOptionalObject: mediaMetaData

Indicates details of the object mediaMetaData.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/getMediaMetaData '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true,
   "metaData":{
      "title":"Big Bang Theory",
      "artist":"BIGBANG",
      "totalDuration":"20.15",
      "album":"BBT",
      "genre":"drama",
      "trackNumber":2
   }
}

getMediaPlayStatus

ACG: mediacontroller.operation
  • Added: API level 12

Description

Gets the current playback status of the given mediaId, status such as stopped, paused, playing, buffering.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session registered.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
playStatusOptionalString

Indicates the current play status of the media.

Possible values are:

  • PLAYSTATE_NONE
  • PLAYSTATE_STOPPED
  • PLAYSTATE_PAUSED
  • PLAYSTATE_PLAYING
  • PLAYSTATE_FAST_FORWARDING
  • PLAYSTATE_REWINDING
  • PLAYSTATE_BUFFERING
  • PLAYSTATE_ERROR
errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/getMediaPlayStatus '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true,
   "playStatus":"PLAYSTATE_PLAYING"
}

getMediaSessionId

ACG: mediacontroller.operation
  • Added: API level 12

Description

Provides the list of mediaId of all the media sessions for a given app.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

appIdRequiredString

Indicates the appId for the given media session.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
mediaIdOptionalString array

Indicates the list of all mediaId for the appId received.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/getMediaSessionId '{
   "appId":"com.webos.test,youtube"
}'

Response:

{
   "returnValue":true,
   "mediaId":[
      "XCFRHKH",
      "NBFSIEOL"
   ]
}

getMediaSessionInfo

ACG: mediacontroller.operation
  • Added: API level 12

Description

Gets the details of a media session like app id, metadata, volume info.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId for the session registered.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
sessionInfoOptionalObject: mediaSession

Indicates media session information details.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/getMediaSessionInfo '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true,
   "sessionInfo":{
      "mediaId":"xDFNUI",
      "appId":"com.webos.test.youtube",
      "metaData":{
         "title":"Big Bang Theory",
         "artist":"BIGBANG",
         "totalDuration":"20.15",
         "album":"BBT",
         "genre":"drama",
         "trackNumber":2
      },
      "volume":100
   }
}

injectMediaKeyEvent

ACG: mediacontroller.management
  • Added: API level 12

Description

Sets the keyEvent of the given displayId.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

displayIdRequiredNumber

Indicates the displayId for which the key event is sent

Possible values are:

  • 0
  • 1
keyEventRequiredString

Indicates the keyEvent for the display.

Possible values are:

  • play
  • pause
  • mute
  • unmute
  • next
  • previous

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4, 7See the API Error Codes Reference section.

See the API Error Codes Reference section

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/injectMediaKeyEvent '{
   "displayId":1,
   "keyEvent":"play"
}'

Response:

{
   "returnValue":true
}

receiveMediaPlaybackInfo

ACG: mediacontroller.management
  • Added: API level 12

Description

Subscribes to receive the play status, mute status, play position, mediaMetaData information.

Recommended usage: The API is recommended to be used by the service.

Parameters

Name

Required

Type

Description

displayIdRequiredNumber

Display for which the media play status is required.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required event type.

Note: If not set, eventType will send all the possible values as the response. 

Possible values are:

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData
  • coverArt
  • supportedActions
subscribeRequiredBoolean

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed.
  • false: Not subscribed.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the operation.

Possible values are:

  • true: Successful.
  • false: Not successful. Check the method's 'Error Codes' section for failure details (errorCode and/or errorText).
subscribedOptionalBoolean

Indicates if subscribed to get notifications (check subscribe parameter).

displayIdOptionalNumber

Display ID for the required media play status.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required subscription response.

Note: If not set, eventType will send all the possible values as the response. 

Possible values are:

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData
  • coverArt​
  • supportedActions
playStatusOptionalString

Indicates the current play status of the media. 

Note: Available only if eventType is playStatus.

Possible values are:

  • PLAYSTATE_NONE
  • PLAYSTATE_STOPPED
  • PLAYSTATE_PAUSED
  • PLAYSTATE_PLAYING
  • PLAYSTATE_FAST_FORWARDING
  • PLAYSTATE_REWINDING
  • PLAYSTATE_BUFFERING
  • PLAYSTATE_ERROR
muteStatusOptionalString

Indicates the current status of the media. 

Note: Available only if eventType is muteStatus.

Possible values are:

  • mute
  • unmute
playPositionOptionalString

Indicates the current play position of the media.

Note: Available only if eventType is playPosition.

mediaMetaDataOptionalObject: mediaMetaData

Indicates the metadata information for the playback.

Note: Available only if eventType is mediaMetaData.

coverArtOptionalObject array: coverArtInfo

Details of media cover art.

Note: Available only if eventType is coverArt.

supportedActionsOptionalString array

List of supported actions that are specified in setSupportedActions method.

Note: Available only if eventType is supportedActions.

Subscription Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the operation.

subscribedOptionalBoolean

Indicates if subscribed to get notifications (check subscribe parameter).

displayIdOptionalNumber

Display ID for the required media play status.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required subscription response.

Note: If not set, eventType will send all the possible values as the response. 

Possible values are:

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData
  • coverArt
  • supportedActions
playStatusOptionalString

Indicates the current play status of the media. 

Note: Available only if eventType is playStatus.

Possible values are:

  • PLAYSTATE_NONE
  • PLAYSTATE_STOPPED
  • PLAYSTATE_PAUSED
  • PLAYSTATE_PLAYING
  • PLAYSTATE_FAST_FORWARDING
  • PLAYSTATE_REWINDING
  • PLAYSTATE_BUFFERING
  • PLAYSTATE_ERROR
muteStatusOptionalString

Indicates the current status of the media. 

Note: Available only if eventType is muteStatus.

Possible values are:

  • mute
  • unmute
playPositionOptionalString

Indicates the current play position of the media playback.

Note: Available only if eventType is playPosition.

mediaMetaDataOptionalObject: mediaMetaData

Indicates the metadata information for the playback.

Note: Available only if eventType is mediaMetaData.

coverArtOptionalObject array: coverArtInfo

Details of media cover art.

Note: Available only if eventType is coverArt.

supportedActionsOptionalString array

List of supported actions that are specified in setSupportedActions method.

Note: Available only if eventType is supportedActions.

Error Codes Reference

Error Code

Error Text

Error Description

2, 10, 11, 12See the API Error Codes Reference section

See the API Error Codes Reference section

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"supportedActions",
   "subscribe":true
}'

Response:

{
    "subscribed": true,
    "displayId": 0,
    "returnValue": true,
    "supportedActions": [
        "play",
        "pause",
        "stop",
        "seekTo",
        "scrubTo",
        "enterPictureInPicture",
        "exitPictureInPicture"
    ],
    "eventType": "supportedActions"
}

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "subscribe":true
}'

Response:

{
    "returnValue": true,
    "coverArt": [
        {
            "sizes": [
                {
                    "width": 128,
                    "height": 128
                }
            ],
            "src": "https://storage.googleapis.com/media-session/sintel/artwork-128.png",
            "type": "image/png"
        }
    ],
    "displayId": 0,
    "playPosition": "1.0",
    "subscribed": true,
    "mediaMetaData": {
        "artist": "BigBang",
        "trackNumber": 2,
        "album": "BBT",
        "totalDuration": "20.15",
        "title": "BigBangTheory",
        "volume": 100,
        "genre": "drama"
    },
    "playStatus": "PLAYSTATE_PLAYING",
    "muteStatus": "mute"
}
 

Example : For eventType as playStatus

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"playStatus",
   "subscribe":true
}'

Response:

{
    "playStatus": "PLAYSTATE_PLAYING",
    "displayId": 0,
    "returnValue": true,
    "subscribed": true,
    "eventType": "playStatus"
}

Example : For eventType as muteStatus

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"muteStatus",
   "subscribe":true
}'

Response:

{
    "subscribed": true,
    "displayId": 0,
    "returnValue": true,
    "muteStatus": "mute",
    "eventType": "muteStatus"
}

Exameple : For eventType as playPosition

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"playPosition",
   "subscribe":true
}'

Response:

{
    "playPosition": "1.0",
    "displayId": 0,
    "returnValue": true,
    "subscribed": true,
    "eventType": "playPosition"
}

Example : For eventType as metaData

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"mediaMetaData",
   "subscribe":true
}'

Response:

{
    "subscribed": true,
    "displayId": 0,
    "returnValue": true,
    "mediaMetaData": {
        "artist": "BigBang",
        "trackNumber": 2,
        "album": "BBT",
        "totalDuration": "20.15",
        "title": "BigBangTheory",
        "volume": 100,
        "genre": "drama"
    },
    "eventType": "mediaMetaData"
}

Example : For eventType as coverArt

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/receiveMediaPlaybackInfo '{
   "displayId":0,
   "eventType":"coverArt",
   "subscribe":true
}'

Response:

{
    "coverArt": [
        {
            "sizes": [
                {
                    "width": 128,
                    "height": 128
                }
            ],
            "src": "https://storage.googleapis.com/media-session/sintel/artwork-128.png",
            "type": "image/png"
        }
    ],
    "displayId": 0,
    "returnValue": true,
    "subscribed": true,
    "eventType": "coverArt"
}

registerMediaSession

ACG: mediacontroller.query
  • Added: API level 12

Description

Registers media sessions, subscribes to receive AVRCP key events.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to be registered. 

appIdRequiredString

Indicates the appId of the session to be registered.

subscribeRequiredBoolean

Indicates if subscribe to get notifications.

Possible values are:

  • true: Subscribed for notifications.
  • false: Not subscribed.

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

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed for notifications.
  • false: Not subscribed.

Note: subscribed will always contain true since subscription ends only when the client chooses to close it.

keyEventOptionalString

Indicates the key event that is operated.

Possible values are:

  • play
  • pause
  • next
  • previous
  • mute
  • unmute
mediaIdOptionalString

Indicates the mediaId of the registered session.

errorCodeOptionalBoolean

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Subscription Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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.
subscribedRequiredBoolean

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed for notifications.
  • false: Not subscribed.

Note: subscribed will always contain true since subscription ends only when the client chooses to close it.

keyEventRequiredString

Indicates the key event that is operated.

Possible values are:

  • play
  • pause
  • next
  • previous
  • mute
  • unmute
mediaIdRequiredString

Indicates the mediaId for which the key events are posted.

errorCodeOptionalNumber

The error code for the failed operation.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See API Error Codes Reference

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/registerMediaSession '{
      "mediaId":"xDFNUI",
      "appId":"com.webos.app.test.youtube",
      "subscribe":true
   }'

Response:

{
   "subscribed":true,
   "returnValue":true
}

setMediaCoverArt

ACG: None
  • Added: API level 30

Description

Sets the cover art data for media session. 

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Media ID of the registered session.

coverArtRequiredObject array: coverArtInfo

Cover art information of the media session.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the operation.

Possible values are:

  • true: Successful.
  • false: Not successful. See 'Error Codes' section for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 2Check error details

For details of a specific error, see the 'API Error codes Reference' table.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setMediaCoverArt '{
   "mediaId":"xDFNUI",
   "coverArt":[
      {
         "src":"https://storage.googleapis.com/media-session/sintel/artwork-96.png",
         "type":"image/png",
         "sizes":[
            {
               "height":96,
               "width":96
            }
         ]
      },
      {
         "src":"https://storage.googleapis.com/media-session/sintel/artwork-128.png",
         "type":"image/png",
         "sizes":[
            {
               "height":128,
               "width":128
            }
         ]
      }
   ]
}'

Response:

{
    "returnValue": true,
}

setMediaMetaData

ACG: mediacontroller.query
  • Added: API level 12

Description

Sets the metadata information for the session.

Example: title, artist.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to set metadata. 

mediaMetaDataRequiredObject: mediaMetaData

Indicates the meta data details for the session.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the API Error Codes Reference section

See the API Error Codes Reference section

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setMediaMetaData '{
   "mediaId":"xDFNUI",
   "mediaMetaData":{
      "title":"BigBangTheory",
      "artist":"BigBang",
      "totalDuration":"10.10",
      "album":"BBT",
      "genre":"drama",
      "trackNumber":2,
      "volume":100
   }
}'

Response:

{
   "returnValue":true
}

setMediaMuteStatus

ACG: mediacontroller.query
  • Added: API level 12

Description

Sets the status of the media session.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session required to set the muteStatus.

muteStatusRequiredString

Indicates the status of the media session.

Possible values are:

  • mute
  • unmute

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4, 7See the API Error Codes Reference section

See the API Error Codes Reference section.

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setMediaMuteStatus '{
   "mediaId":"xDFNUI",
   "muteStatus":"mute"
}'

Response:

{
   "returnValue":true
}

setMediaPlayPosition

ACG: mediacontroller.query
  • Added: API level 12

Description

Sets the play position for the media session.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session.

playPositionRequiredString

Indicates the current play position of the media session.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4, 7See the API Error Codes Reference sectio

See the API Error Codes Reference section

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setMediaPlayPosition '{
   "mediaId":"xDFNUI",
   "playPosition":"10.10"
}'

Response:

{
   "returnValue":true

}

setMediaPlayStatus

ACG: mediacontroller.query
  • Added: API level 12

Description

Sets the playStatus for the session.

Example: play, pause, stopped and so on.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to set playStatus.

playStatusRequiredString

Indicates the current playStatus of the media.

Possible values are:

  • PLAYSTATE_NONE
  • PLAYSTATE_STOPPED
  • PLAYSTATE_PAUSED
  • PLAYSTATE_PLAYING
  • PLAYSTATE_FAST_FORWARDING
  • PLAYSTATE_REWINDING
  • PLAYSTATE_BUFFERING
  • PLAYSTATE_ERROR

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4 , 8See the API Error Codes Reference section.

See the API Error Codes Reference section

Example

Example scenario

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setMediaPlayStatus '{
   "mediaId":"xQWERTY_0",
   "playStatus":"PLAYSTATE_PLAYING"
}'

Response:

{
   "returnValue":true
}

setSupportedActions

ACG: None
  • Added: API level 31

Description

Sets the list of supported media actions.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Media ID of the registered session.

supportedActionsRequiredString array

List of actions to be supported. It can include values such as:

  • play
  • pause
  • next
  • previous
  • mute
  • unmute

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the operation.

Possible values are:

  • true: Successful.
  • false: Not successful. See 'Error Codes' section for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 2Check error details.

For details of a specific error, see the API Error Codes Reference table.

Example

Example : Set play, pause, and next as supported actions

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/setSupportedActions '{"mediaId":"xDFNUI", "supportedActions":["play", "pause", "next"]}'

Response:

{
    "returnValue": true
}

unregisterMediaSession

ACG: mediacontroller.query
  • Added: API level 12

Description

Unsubscribes and unregisters the media session.

Recommended usage: The API is recommended to be used by the application.

Parameters

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId of the session to be unregistered.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of the 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

Indicates the reason for the failure of the operation. See the "Error Codes" section of this method for details.

Error Codes Reference

Error Code

Error Text

Error Description

0, 1, 2, 3, 4See the "API Error Codes Reference" section.

See the API Error Codes Reference section.

Example

Example code

# luna-send -n 1 -f luna://com.webos.service.mediacontroller/unregisterMediaSession '{
   "mediaId":"xDFNUI"
}'

Response:

{
   "returnValue":true

Objects

coverArtInfo

Details of media cover art.

Name

Required

Type

Description

srcRequiredString

Source URI of cover Art image.

typeOptionalString

Type of image format.

sizesOptionalObject array: sizes

Size of images.

coverArtPathInfo

Provides cover art source URI and downloaded path.

Name

Required

Type

Description

srcRequiredString

Source URI of cover art image.

srcPathRequiredString

Provides downloaded cover art source path

mediaMetaData

Contains the mediaMetaData information.

Name

Required

Type

Description

titleOptionalString

Indicates the title of the media.

artistOptionalString

Indicates information about the artist.

totalDurationOptionalString

Indicates the total duration of the media.

albumOptionalString

Indicates details about the album.

genreOptionalString

Indicates details about the genre.

trackNumberOptionalNumber

Indicates the track number.

volumeOptionalNumber

Indicates the current volume level of the session.

mediaSession

Contains the details about mediaId, appId, and metaData.

Name

Required

Type

Description

mediaIdRequiredString

Indicates the mediaId to be registered.

appIdRequiredString

Indicates the corresponding appId of the mediaId.

metaDataRequiredObject: mediaMetaData

Indicates the details of metaData such as title, artist, total duration, album, genre, and track number.

sizes

Provides possible sizes for each cover art

Name

Required

Type

Description

widthOptionalNumber

Indicates the width of the image.

heightOptionalNumber

Indicates the height of the image.

API Error Codes Reference

Error Code

Error Text

Error Description

0Invalid mediaId

Indicates that the mediaId received is invalid.

1MediaId registration failed

Indicates the failure of mediaId registration.

2Parsing Error

Indicates parsing of data has failed.

3Invalid appId

Indicates that the appId does not match the mediaId.

4No active session

Indicates that no session is active.

5Media Session already registered

Indicates that session is already registered

6Media Session already active

Indicates that session is already activated

7Media Session already decativated

Indicates that session is already deactivated

8Invalid Play Status

Indicates Invalid play state of media.

10"" (empty)

Indicates No Error

11Invalid displayId

Indicates invalid displayid

12Invalid Event

Indicates invalid event

Contents