Thanks Alex!

When you say peek at the MediaPlaybackService you mean android
framework code?

I was afraid that MediaPlayer would somehow end in an invalid state if
the internal server died or something but I guess reset() cleans it
up...  As of now I just use Reset() to stop playback.. :P seems to be
faster than Stop() plus it cleans the MediaPlayer to be ready for
another SetDataSource() and Prepare()...

Something I don't like about MediaPlayer is that you can't get the
audio status!  Say it's progressively playing a file from the internet
and  all the sudden audio stops because it doesn't have enough
data...  I want to know when that happens and there is no information
for that...  Any ideas on this part?

Thanks,
-Moto

On Nov 4, 3:34 am, Alexey Krasnoriadtsev <[email protected]>
wrote:
> Preparing a mediaPlayer is the most expensive operation.
> calling stop() or pause() and then start() works best for me. You can
> also peek at the MediaPlaybackService for inspiration.
>
> Why do you think it will get into the bad state?
>
> On Nov 3, 7:14 pm, Moto <[email protected]> wrote:
>
> > What is the best way to use the MediaPlayer when needed multiple
> > times?
>
> > Reuse the instantiated MediaPlayer throughout the session?  Or
> > constantly stop() release() and instantiate a new MediaPlayer() ?
>
> > If I reuse I'm afraid the player could be in a bad state?
> > What about performance wise? what's better? reuse or renew?
>
> > Note: This is for using as a music player so one audio be present at
> > one given time...
>
> > Thank!
> > -Moto!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to