Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am trying to understand why I cannot keep listening the audio of a YouTube video on my Galaxy S 2 while moving to another application for example reading a wikipedia article on the browser.

is there any architectural limitation which prevents this in Gingerbread (hopefully will be removed in ICS) or is only the way Google made the YouTube application?

Edit: tried out YouTube application in ICS 4.0.3 today and behaves the same as in Gingerbread :(((

share|improve this question
8  
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 Yaga Jan 18 '12 at 15:09
    
Related: android.stackexchange.com/questions/3079/… –  Flow Feb 16 '12 at 12:38
add comment

3 Answers

up vote 17 down vote accepted

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.

share|improve this answer
    
yeah but to use YouTube as radio, it could disable the video rendering and only play the audio! :) –  Davide Piras Jan 18 '12 at 15:56
6  
You could - but that's simply not how the Youtube app is designed ;) –  lxgr Jan 18 '12 at 16:27
add comment

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:

rtsp://v8.cache8.c.youtube.com/CigLENy73wIaHwlcw_gs85OUchMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp

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.

./openRTSP -a rtsp://v8.cache8.c.youtube.com/CigLENy73wIaHwlcw_gs85OUchMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp | ./mplayer -cache 8092 - -rawaudio channels=1:rate=8000:samplesize=2:format=0x73616D72

This CLI expression is further described in a link at the bottom.

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:

http://gdata.youtube.com/feeds/api/users/rowntreerob/uploads?vq=cpST8yz4w1w&prettyprint='true'

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
share|improve this answer
add comment

It's not a limitation of Android, but a "feature" of the Youtube app to conserver resources.

If you want to use Youtube as a music player, I think you should be able to find an application that allows you to do exactly that in the market.

TubeMate lets you listen to only the audio of a Youtube file (you have to download it in advance, though), and that should work in the background.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.