Sometimes your setup might need to use a button to control playback. The Raspberry has a bunch of inputs and outputs, called GPIO, which is the long connector on top of the board. Buttons, switches, relays can be used to either skip to the next file in a list of files, or restart playback, if only one file is played back. Another can pause and restart playback.
To build the hardware, you will need a standard button or switch (closing the circuit while being pressed), a connector for the GPIO and some wire. Simply make the switch connect +3.3V (Pin 1) and Pin 11 (pause) or 13 (quit player = skip / restart), as shown here:
This is a small piece of prototyping board sitting on top of the 2-row connector, which plugs into the rapsberry pi. The blue part is a wire screw terminal, so it becomes easy to exchange switches. The red wires are connecting the terminal to Pin 1 (for 3,3V) and Pin 13, the 7th Pin on that side.
It is possible to connect more switches or other sensors to the Raspberyy this way, with minor changes to the script. Find out more: Hacking the Player