I assume it is just the YouTube application. Google Music (and nearly every other music app I have tried) will continue to play if apps are switched, or even if the screen is turned off (YouTube stops if the screen is off as well).
–
Dylan YagaJan 18 '12 at 15:09

3 Answers
3

Video rendering, which would have to happen even if the application is not "active" but still playing, is going to use a lot more battery then "normal usage". So if you are not "watching" the video, it stops in order to not waste precious battery power.

If you want an android app that would allow flexible management of the Youtube streaming protocols in a way that would support selection of just the audio portion of the media stream while discarding the video track, keep an eye on VLC for android. It is still 'under developement' but would probably address the 'audio only' feature.

From a more technical perspective, it helps to break the issue down into available Youtube network protocols for media streaming RTSP. RTSP specs allow a client to make a request using the DESCRIBE command to which the server responds with an SDP data segment (see details below). Youtube servers can respond in a variety of protocols , sending underlying streams that in turn use a variety of encodings -one for audio, one for video- to transfer the media bits across the network to the client. Over the mobile networks, a feature that goes to youtube in order to receive both audio and video tracks before discarding video while playing only audio is not a good practice because of the heavy network requirement for the unused video stream. You can get around the network inefficiency with some further technical drill-down.

RTSP and SDP standards observed by Youtube would allow a streaming client (android device) to request ONLY the Audio during the Client/Server handshake steps and negotiation steps around the network connection setup that will do the media streaming. In this case, no video would be sent and the android player would be configured on an audio only stream. Some CLI command details and some protocol details on this ‘youtube audio only’ scenario follow.

A youtube, format 1 audio only track for a particular video is available at the following RTSP URI:

From the RTSP URI for the entire video (audio track plus video track) , the following CLI expression makes use of 2 media clients openRTSP and mPlayer going to Youtube where it then GETS/PLAYS just the Youtube audio track by requesting only channel=1.

Youtube ‘feeds’ describe the available stream formats for any Youtube video, including the RTSP URI’s mentioned above. For a Tech explanation of Youtube streaming formats see the entry for ‘format’ 1,5,6 in the long table.

The following request gets a feed from Youtube that includes the variously formatted RTSP URI’s that are available for that particular video:

The gory details of a connnected RTSP SESSION in which the full SDP description is requested for a particular youtube video so that just the audio track could be streamed/played are here.

Key to numbered lines in above link:

82 – the RTSP DESCRIBE request
101 – the SDP response
103 – video track’s format
116 – the attributes describing the audio track
line 165 – the audio track setup by the player
184 – the audio-only playback
201 – using a separate CLI expression this is playback of a previous download on just the audio track