for connected embedded systems
![]() |
![]() |
![]() |
Appendix: The phplay Remote Control Interface
The phplay remote control interface gives any Photon application control over the behavior of the currently registered phplay.
To control phplay remotely, a Photon application must:
Find phplay
To ensure that only one instance of phplay listens for remote messages, a connector is created with a unique registered name ("phplay") when the first phplay instance is created.
Any Photon application can connect to phplay by calling the Photon library function PtConnectionFindName(). For example:
PtConnectionClient_t *client = PtConnectionFindName( "phplay", 0, 0 );
Fill in the remote message structure
The MvRemote_t structure describes the messages received by phplay from remote applications.
typedef struct MvRemoteMsg
{
enum MvCommandType CommandType;
int KeypadNum;
int bToDelete;
char newurl[MV_MAX_URLLEN];
int reserve_1;
int reserve_2;
int reserve_3;
} MvRemoteMsg_t;
It contains at least the following members:
- CommandType
- Valid commands that phplay accepts are:
- CMD_PLUGIN_EJECT_DISK
- CMD_PLUGIN_ENTER
- CMD_PLUGIN_LAST_CHAPTER
- CMD_PLUGIN_LOAD_DISK
- CMD_PLUGIN_L_R
- CMD_PLUGIN_MUTE
- CMD_PLUGIN_NEXT_CHAPTER
- CMD_PLUGIN_OPEN_URLS
- CMD_PLUGIN_OSD
- CMD_PLUGIN_PAUSE
- CMD_PLUGIN_PLAY_PAUSE
- CMD_PLUGIN_POWER
- CMD_PLUGIN_SCAN_BACK
- CMD_PLUGIN_SCAN_FORWARD
- CMD_PLUGIN_SLOW_MOTION
- CMD_PLUGIN_START
- CMD_PLUGIN_STEP
- CMD_PLUGIN_STOP
- CMD_PLUGIN_TITLE
- CMD_PLUGIN_VGA_TV
- CMD_PLUGIN_VOL_DOWN
- CMD_PLUGIN_VOL_UP
- KeypadNum
- The track number phplay should play if plugin that's currently loaded is multitrack. This field is used in association with CMD_PLUGIN_ENTER.
- bToDelete
- A boolean that instructs phplay to delete from the file system, the URL contained in the newurl field of the MvRemoteMsg_t message, when the associated plugin is unloaded. This field is use in association with CMD_PLUGIN_OPEN_URLS.
- newurl
- String that contains the URL to be played (1023 char max). This field is used in association with CMD_PLUGIN_OPEN_URLS.
Send the message to phplay
Here are some code examples that use the Photon library function PtConnectionSend().
Send an open URL command to phplay:
{
PtConnectionClient_t *client = PtConnectionFindName( "phplay", 0, 0 );
if( client )
{
MvRemoteMsg_t msg = {0};
msg.CommandType = CMD_PLUGIN_OPEN_URLS;
strcpy(msg.newurl, "http://www.sky.net/~jdeshon/jad0025a.wav");
// or strcpy(msg.newurl, "file:///var/media/revenge.wav");
// or strcpy(msg.newurl, "/var/media/revenge.wav");
PtConnectionSend( client, 0, &msg, 0, sizeof(msg), 0 );
}
}
Send a start command to phplay:
{
PtConnectionClient_t *client = PtConnectionFindName( "phplay", 0, 0 );
if( client )
{
MvRemoteMsg_t msg = {0};
msg.CommandType = CMD_PLUGIN_START;
PtConnectionSend( client, 0, &msg, 0, sizeof(msg), 0 );
}
}
Send a change track command to phplay:
{
PtConnectionClient_t *client = PtConnectionFindName( "phplay", 0, 0 );
if( client )
{
MvRemoteMsg_t msg = {0};
msg.CommandType = CMD_PLUGIN_ENTER;
msg.KeypadNum = 5; // go to track 5
PtConnectionSend( client, 0, &msg, 0, sizeof(msg), 0 );
}
}
![]() |
![]() |
![]() |

![[Previous]](prev.gif)
![[Contents]](contents.gif)
![[Next]](next.gif)