How to play a YouTube video in the background on iOS

Update: This doesn't work on newer versions of iOS.

Sometimes, I want to hear a song on YouTube while doing other stuff on my iPhone. After a bit of poking around, I figured out how to do it:

  1. Start the video playing.
  2. Hit the Home button to return to the home screen.
  3. Double-tap the Home button to bring up the multitasking tray.
  4. Swipe to the left and hit the Play button.