With newer car headunits, the radio turning off while the engine cranks no longer cuts it. While the ~20 second loading time of an MP3 playing off USB is annoying, it's worse if you're on a Bluetooth phone call and need to start your engine.
I've seen a few more complex solutions, but here's the easiest.
All you need is a big capacitor (I think I used a 2700uf and a 4700uf in my two cars), and a diode. The capacitor connects to ground and the accessory wire (switched live). The diode simply goes on the accessory wire to stop the capacitor feeding the rest of the accessory circuit. It's not 100% essential on some cars, but if you have say an old LCD clock, anything pluged into your 12v socket etc, you'll probably need it.
When you key off, the capacitor keeps the switched live on for a few seconds. Since the current draw on this wire is tiny, you don't need a massive cap. ~2700uf corresponds to around 8 seconds play time, 4700uf is around 20 seconds. I went with a big cap since I have excess electricity and a neat side effect is that you can still hear your music playing as you unlock your house door.
This won't work on all cars, I tried it on my Proton and Renault and they worked, doesn't work on my Jeep which apparently just sucks too much juice from the battery while cranking?
Hard to photograph, but every thread needs a pic, but frankly pretty self explanitory (the extra wire is for a radio switch):