Object to control multimedia playback
You can control media playback from PPS objects by using the /pps/applications/mediaplayer object. This will be the entry point for voice control, external physical buttons (e.g., on the steering wheel), or other means to remotely control the mediaplayer.
Commands sent to the /pps/applications/mediaplayer object are of the form:
req:json:{"id":ID_number, "cmd":"command_string"}
The ID_number is a unique identifier that will be reflected in the response from the PPS service to your request. You can set the ID to any number you wish.
req:json:{"id":1, "cmd":"stop"}
req:json:{"id":1, "cmd":"pause"}
req:json:{"id":1, "cmd":"next"}
req:json:{"id":1, "cmd":"prev"}
req:json:{"id":1, "cmd":"play"}
req:json:{"id":1, "cmd":"play", "data": {"type":"fid", "id":1}}
req:json:{"id":1, "cmd":"play", "data": {"type":"artist", "id":1}}
req:json:{"id":1, "cmd":"play", "data": {"type":"album", "id":1}}
The data-level ID field can be the fid, artist_id, or album_id from the mmlibrary.db database. You can obtain these by using the queries in the MMLibrary class included with the mediaplayer app.
Stop the currently selected song:
echo 'req:json:{"id":1, "cmd":"stop"}' >> /pps/applications/mediaplayer
Play the next song in the list:
echo 'req:json:{"id":1, "cmd":"next"}' >> /pps/applications/mediaplayer