MediaPlayer Threading Issue

All your problems with Audio, Video and Images.

MediaPlayer Threading Issue

Postby saphiroth » Fri Oct 16, 2009 8:31 pm


In the Google API it states that media playback should be done on a service b/c if an Activity starts the playback and the user presses the back button; leaves the activity, then the mp3 playback will stop. I tried this on the emulator and in fact the music keeps playing even after I hide the activity that started the MediaPlayer playback. So does that mean the the API documentation is wrong?

Also, the API says that a service runs in the same thread as the activity. The service will block the UI thread if the service is doing something CPU intensive. if I have a service that will play an mp3 and the service was started from an activity, will the activity UI be blocked by the service since the service did not spin off another thread to play the mp3? I tried this and everything worked fine...meaning that nothing was blocked regardless of what the API said. So I'm very confused.

Would someone be able to shed some light on this phenomenon?

Thank you very much!
Junior Developer
Junior Developer
Posts: 12
Joined: Fri Oct 31, 2008 5:22 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 15 guests