As far as I know, with the YouTube API for Android, the player automatically stops when it\'s out of view. For example, when the app is closed or when another view is positioned
To play only the audio of a YouTube video violates the YouTube API Terms of Service:
Your API Client will not, and You will not encourage or create functionality for Your users or other third parties to:
9. promote separately the audio or video components of any YouTube audiovisual content made available through the YouTube API;
For educational purposes take a look at the Services developer guide.
A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background
The MixerBox app you mention most likely has a Service
that it delegates the play back of the video's audio to when its' Activity's onPause()
callback is executed by the system. That is how MixerBox
allows you to navigate away from the application and you can still here the audio playing from the video.