API Methods
- misc
- media
- controls
- volume
luna://com.alanstice.cast.service/listDevices
Indicate the service should start discovery (if it has not already).
Parameters:
| Name |
Required |
Type |
Description |
| subscribe |
true |
Boolean |
subscribe should be true - service will only discover devices while an application is subscribed to device list. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be false for requests. Applications must subscribe to receive device list |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| subscribed |
false |
Boolean |
subscribed will be true if the subscription is successful, false otherwise |
| devices |
false |
Device Array |
devices will contain an array of Device objects. |
| event |
false |
String |
event will be one of ["found", "lost"] |
| device |
false |
Device |
device will be the modified device |
Error Codes:
None
Examples:
luna-send -n 1 -f luna://com.alanstice.cast.service/listDevices {}
{
"returnValue": false,
"errorCode": 405,
"errorText": "Request not allowed, please subscribe"
}
luna-send -i -f luna://com.alanstice.cast.service/listDevices '{"subscribe": true}'
{
"returnValue": true,
"subscribed": true,
"devices": []
}
{
"event": "found",
"device": {
"id": "0",
"name": "LG webOS TV",
"type": "webOS"
},
"devices": [
{
"id": "0",
"name": "LG webOS TV",
"type": "webOS"
}
]
}
{
"event": "lost",
"device": {
"id": "0",
"name": "LG webOS TV",
"type": "webOS"
},
"devices": []
}
luna://com.alanstice.cast.service/playMedia
Cast media (audio, video, image) to a device
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Cast target: must match a found Device ID |
| media |
true |
Object OR Object array |
Must be a Media object, or array of Media objects |
| subscribe |
false |
Boolean |
Subscribe for cast status updates. May not be available on all platforms. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise. |
| subscribed |
false |
Boolean |
subscribed, returned on first response, will be true if successfully subscribed, false otherwise |
Examples:
luna://com.alanstice.cast.service/getDuration
Get the media duration
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| subscribe |
false |
Boolean |
true to subscribe for duration updates, false for single poll. Will be internally abstracted as a poll interval if target platform doesn't support subscribing. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
| duration |
false |
Number |
Media duration in seconds |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise. |
| subscribed |
false |
Boolean |
subscribed, returned on first response, will be true if successfully subscribed, false otherwise |
| duration |
true |
Number |
Media duration in seconds |
Examples:
luna://com.alanstice.cast.service/getPosition
Get (or subscribe to) the media position
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| subscribe |
false |
Boolean |
true to subscribe for position updates, false for single poll. Will be internally abstracted as a poll interval if target platform doesn't support subscribing. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
| position |
false |
Number |
Current media position in seconds |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise. |
| subscribed |
false |
Boolean |
subscribed, returned on first response, will be true if successfully subscribed, false otherwise |
| position |
true |
Number |
Current media position in seconds |
Examples:
luna://com.alanstice.cast.service/getStatus
Get (or subscribe to) the media status
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| subscribe |
false |
Boolean |
true to subscribe for status updates, false for single poll. Will be internally abstracted as a poll interval if target platform doesn't support subscribing. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
| playState |
false |
String |
The media play state ("playing", "paused", etc) |
| playingMedia |
false |
String |
The URI (or file path) of the playing media |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise. |
| subscribed |
false |
Boolean |
subscribed, returned on first response, will be true if successfully subscribed, false otherwise |
| playState |
true |
String |
The media play state ("playing", "paused", etc) |
| playingMedia |
true |
String |
The URI (or file path) of the playing media |
Examples:
luna://com.alanstice.cast.service/seek
Seek to the specified position
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| position |
true |
Number |
Seek time in seconds, must be in the range [0,duration] |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/jumpTo
Jump to a specific item in the playlist
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| index |
true |
Number |
Playlist index to seek to |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/next
Skip to the next item in the playlist
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/previous
Skip to the previous item in the playlist
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/fastForward
Send the fast forward command to the device. Behavior depends on device implementation.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/pause
Send the pause command to the device. Behavior depends on device implementation.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/play
Send the play command to the device. Behavior depends on device implementation.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/rewind
Send the rewind command to the device. Behavior depends on device implementation.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/stop
Send the stop command to the device. Behavior depends on device implementation.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/getVolume
Get the volume from the device. May not work correctly on Chromecast.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| subscribe |
false |
Boolean |
true to subscribe for volume updates, false for single poll. Will be internally abstracted as a poll interval if target platform doesn't support subscribing. |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
| volume |
false |
Number |
If not error occurs, volume will be returned in range [0,100] |
Subscription Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise. |
| subscribed |
false |
Boolean |
subscribed, returned on first response, will be true if successfully subscribed, false otherwise |
| volume |
true |
Number |
The device volume, in range [0,100]. |
Examples:
luna://com.alanstice.cast.service/setVolume
Set the volume on the device. May not work correctly on Chromecast
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
| volume |
true |
Number |
New volume value, [0,100] |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/volumeDown
Decrease the device volume by one.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
luna://com.alanstice.cast.service/volumeUp
Increase the device volume by one.
Parameters:
| Name |
Required |
Type |
Description |
| target |
true |
String |
Target Device ID to access |
Response:
| Name |
Required |
Type |
Description |
| returnValue |
true |
Boolean |
returnValue will be true on success, false otherwise |
| errorCode |
false |
Number |
If an error occurs, errorCode will contain numeric error code |
| errorText |
false |
String |
If an error occurs, errorText will contain a description of the error |
Examples:
Objects
Device
An object representing a connectable device
Properties
| Name |
Type |
Description |
| id |
String |
Unique identifier, used to interact with the device |
| name |
String |
User friendly name for representing the device in UI |
| type |
String |
Device type. (e.g. webOS, Chromecast or Chromecast Audio) |
Media
An object representing cast target media
Properties
| Name |
Type |
Description |
| path |
String |
URI pointing to the media or, if local flag is true, filesystem path to the media |
| mimeType |
String |
The media's mimeType |
| local |
Boolean |
true if the media is stored locally, false if it's hosted |
| title |
String |
Title to display with media |
| description |
String |
Description to display with media |
| poster |
String |
URI pointing to a poster image. Will be displayed while video is loading or as album art for audio. |