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"
   ]
}

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

Indicates the displayId for which the media play status is required.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required subscription response.

Possible values are :

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData

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

subscribeRequiredBoolean

Indicates if subscribed to get notifications.

Possible values are:

  • true: Subscribed for notifications
  • false: Not subscribed

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

Indicates if subscribed to get notifications.

Possible values are:

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

Indicates the displayId for the required media play status.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required subscription response.

Possible values are :

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData

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

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

Note: The information will be sent if the eventType is playStatus.

muteStatusOptionalString

Indicates the current status of the media. 

Possible values are:

  • mute
  • unmute

Note: The information will be sent if the eventType is muteStatus.

playPositionOptionalString

Indicates the current play position of the media.

Note: The information will be sent if the eventType is playPosition.

mediaMetaDataOptionalObject: mediaMetaData

Indicates the metadata information for the playback.

Note: The information will be sent if the eventType is 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.

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

Indicates if subscribed to get notifications.

Possible values are:

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

Indicates the displayId for the required media play status.

Possible values are:

  • 0
  • 1
eventTypeOptionalString

Indicates the status for the required subscription response.

Possible values are :

  • playStatus
  • muteStatus
  • playPosition
  • mediaMetaData

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

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

Note: The information will be sent if eventType is playStatus.

muteStatusOptionalString

Indicates the current status of the media. 

Possible values are:

  • mute
  • unmute

Note: The information will be sent if the eventType is muteStatus

playPositionOptionalString

Indicates the current play position of the media playback.

Note: The information will be sent if the eventType is playPosition.

mediaMetaDataOptionalObject: mediaMetaData

Indicates the metadata information for the playback.

Note: The information will be sent if the eventType is 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, 4, 6, 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/receiveMediaPlaybackInfo '{
   "displayId":0,
   "subscribe":true
}'

Response:

{
   "returnValue":true,
   "displayId":0,
   "playStatus":"PLAYSTATE_PLAYING",
   "muteStatus":"unmute",
   "playPosition":"10.10",
   "metaData":{
      "title":"Big Bang Theory",
      "artist":"BIGBANG",
      "totalDuration":"20.15",
      "album":"BBT",
      "genre":"drama",
      "trackNumber":2
   }
}

With eventType as playStatus

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

Response:

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

With eventType as muteStatus

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

Response:

{
   "returnValue":true,
   "displayId":0,
   "eventType":"muteStatus",
   "muteStatus":"unmute"
}

With eventType as playPosition

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

Response:

{
  "returnValue":true,
  "displayId":0,
  "eventType":"playPosition",
  "playPosition":"10.10"
}

With eventType as metaData

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

Response:

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

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
}

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, 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/setMediaPlayStatus '{
   "mediaId":"xQWERTY_0",
   "playStatus":"PLAYSTATE_PLAYING"
}'

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

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.

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

Contents