Handling the Play and Pause Commands
The Play and Pause buttons on the remote control generate separate commands, APPCOMMAND_MEDIA_PLAY and APPCOMMAND_MEDIA_PAUSE, respectively. In addition, some keyboards use a single button to switch between the playing and paused states, generating an APPCOMMAND_MEDIA_PLAY_PAUSE message. Applications should be able to process messages from either the remote control or the keyboard, while keeping track of the current playback state and responding appropriately.
The following table shows the playback state, the keyboard or remote control command, and the recommended action an application should take in response to these messages.
State | Command | Action |
Stopped | APPCOMMAND_MEDIA_PLAY | Play |
Stopped | APPCOMMAND_MEDIA_PAUSE | Nothing |
Stopped | APPCOMMAND_MEDIA_PLAY_PAUSE | Play |
Playing | APPCOMMAND_MEDIA_PLAY | Nothing |
Playing | APPCOMMAND_MEDIA_PAUSE | Pause |
Playing | APPCOMMAND_MEDIA_PLAY_PAUSE | Pause |
Paused | APPCOMMAND_MEDIA_PLAY | Play |
Paused | APPCOMMAND_MEDIA_PAUSE | Nothing |
Paused | APPCOMMAND_MEDIA_PLAY_PAUSE | Play |
See Also