Heres how:
launch the YouTube video in Safari, not the YouTube app and start playing it.
Press the home button to return to your home screen.
The video and audio will stop.
Now press the play button on your earbuds.
YouTube playing on iPhone background| YouTube