The Now Playing service listens for commands on this control object
Commands sent to the /pps/services/multimedia/mediacontroller/control object are of the form:
msg::command_string\nid::ID_number\nparameter_data
Responses always reflect the command_string and ID_number that were sent in the message, along with any errors:
res::command_string\nid::ID_number\nerror::error_description
Command | Parameters | Data type | Description |
---|---|---|---|
app_maximize | n/a | n/a | Request that the active player be maximized. |
b_down | button_id:bid_value | JSON | Notifies Now Playing of a button make event, intended only for the hardware button
driver. The bid_value parameter can be one of:
|
b_up | button_id:bid_value | JSON | Notifies Now Playing of a button break event, intended only for the hardware button driver. For the bid_value parameter, see the description above for b_down. |
v_set | vlevel | String | Set the volume level to the given vlevel (a number from 0 to 100). |
v_up | n/a | n/a | Increase the volume level by one step. Media volume typically has 16 steps, voice has 10. Increasing the volume by one step has the effect of a 6.25% increase. |
v_down | n/a | n/a | Decrease the volume level by one step. |
v_mute | mute | Boolean | Set the mute state to true or false. |
v_update | n/a | n/a | Indicates that a volume or mute update was done to the audioman service; the Now Playing service should reread it and display a toast notification. |
m_play | n/a | n/a | Direct the connected media player to play its content. |
m_pause | n/a | String | Direct the connected media player to pause its content. |
m_playpause | n/a | String | Toggle the pause state and direct the connected media player to play or pause its content accordingly. |
m_stop | n/a | String | Direct the connected media player to stop its content. |
m_previous | n/a | String | Direct the connected media player to jump to the start of the current track or to the previous track. |
m_next | n/a | String | Direct the connected media player to jump to the start of the next track. |
m_fforward | n/a | String | Direct the connected media player to enter fast-forward mode. |
m_rewind | n/a | String | Direct the connected media player to enter rewind mode. |
md_subscribe | n/a | n/a | Request that the caller subscribe to updates in metadata, track change, and state for the currently playing content. |
md_unsubscribe | n/a | n/a | Request that the caller no longer subscribe to changes for the currently playing content. |
Besides returning the client's message and ID, the Now Playing service can also send these responses:
Response | Parameters | Data type | Description |
---|---|---|---|
m_active_pid | pid | Number | Provides the active music player's process ID. A value of 0 indicates no active player. |
m_background_player_pid | pid | Number (for the number of pids); JSON (for each pid) |
Provides the process IDs of the backgrounded (interrupted) players. A value of 0 indicates no backgrounded players. The format for this message is as follows: msg::m_background_player_pid\nnumber:n:number_of_pids\ndat:json:pid1, pid2, ... |
m_bg_pid | pid | Number | Provides the backgrounded (interrupted) music player's process ID. A value of 0 indicates no backgrounded player. |
m_preactive_pid | pid | Number | Provides the process ID of the preactive phone player. This is intended to be used by the phone when screening an incoming call. A value of 0 indicates no preactive player. |
m_state | state | String | This message is sent only to subscribing controllers. Reflects the active player's state in the system. The state parameter can be one of:
Note that trackchange only delimits tracks—it doesn't indicate a state change (from stopped, paused, or playing). The player is expected to send msg::state\ndat::trackchange at every change of track to generate the trackchange message to the controller. |
md_update | md_attribute:value | JSON | This message is sent only to subscribing controllers. Reflects the initial (or change in)
metadata for the currently played track to each client controller listening for metadata changes.
Strictly speaking, the metadata attributes are arbitrary because these PPS interfaces will proxy any metadata information from the active media player in the system to all subscribed controllers. Known metadata attributes include:
The nextEnabled and prevEnabled attributes are intended to be sent by media players that support and enable the fancy overlay in the volume toast. |
# exec 3<> /pps/services/multimedia/mediacontroller/control
# echo "msg::v_set\nid::1\ndat::50" >&3; cat <&3
@control res::v_set id::1 error::ok