title: Should a MediaPlayer run in separate thread?
body: <p>I'm building an app that streams music from a web server. The app has foreground service that uses a MediaPlayer for playback. </p>
  
  <p>My code is based on this example: <a href="http://developer.android.com/guide/topics/media/mediaplayer.html">http://developer.android.com/guide/topics/media/mediaplayer.html</a></p>
  
  <p>In the example, nothing is threaded except the prepareAsync() call. What confuses me is that when I read about the Service class I find this information: </p>
  
  <p><em>"Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise). This means that, if your service is going to do any CPU intensive work or blocking operations (such as MP3 playback or networking), you should create a new thread within the service to do that work. By using a separate thread, you will reduce the risk of Application Not Responding (ANR) errors and the application's main thread can remain dedicated to user interaction with your activities."</em></p>
  
  <p>The reason I'm asking is that the app some times (usually when loosing connection) freezes the UI when streaming audio. I totally understand that the UI freezes if the service is making CPU intense work, since the activity and the service runs on the same thread. But, should I expect the MediaPlayer to be this intense? That is, should it run on a separate thread?</p>