Android 1.5 - How does MediaPlayer know when to start playback?

by Moto » Thu, 30 Apr 2009 00:54:27 GMT

Sponsored Links
 Hi all I need some deep understanding on the MediaPlayer class.

Here are a couple questions:
1. How does the MediaPlayer class know when to start playback when
playing an external file x size ie. "http:\\\file.mp3"  at
what point does it say we got enough data lets start playback?  from
my experience this varies a lot depending on the connection speed of
the phone and also how the phone feels like...

2. How can I know that MediaPlayer is now stuck with internal
buffering and not playing audio anymore?  I would have assumed the
OnInfoListener would let us know something? or maybe when checking
IsPlaying() would return false since it's buffering and no audio is

would have been nice to have {Idle, Initialized, Prepared, Stopped,
PlaybackCompleted, Error, etc..} and add a state
"InternalBuffering" ?  and have access to this states...

Any other classes that would have access to this information?


Other Threads

1. What colour to use for custom contentView in notification for 2.2 and 2.3

So I've got a custom view being used as a RemoteViews in a notification.

Looking in the 2.2. resource, I can see 
\layout\status_bar_latest_event_content.xml where it explicitly sets the 
colour of the title and text to "ff000000". Which works nicely under 2.2 
stock. The text is black.

But under 2.3, the notification bar is darker and black text is not visible. 
Looking in the same file under 2.3 I find it is now using a 
This is using ?textColorPrimaryInverse which is white but the same value 
under 2.2 is also white.

The TextAppearance.StatusBar style hierarchy doesn't exist for 2.2 or below.

So should I check for the sdk version and if running 2.3+ then get the value 
of the style attribute and manually override the color for the custom 
view..? Seems a bit of a faff to have to do that? And how do I compile it to 
refer to that new attribute when I'm targetting 2.2? Any way to get it to 
work purely in xml with no additional java faff..?

But I'm also wondering about all that theming going on for custom roms - how 
do they handle this..? For a 2.2. phone, the text colour of black is 
hardcoded into that layout. So does that mean that no theme for a 2.2. 
device can change the colour of the notification bar background to black 
otherwise all the notifications will be unreadable? Am I missing something 


2. Communicating between two devices directly


I'm in need of communicating between two devices over WiFi directly,
w/o need of AP. As far as I know adhoc mode
is not supported oficially (unless you apply some unofficial patches
to wpa_suplicant) but maybe I miss something
and certain version of Android  going to officially support adhoc?
Anyway, I am open for any hints of solution I could
use to get this done (BT is out of question due to limited range. At
worst I can use client-server architecture but
I would like to avoid this as it requires data plan and/or carrier coverage)


3. a simple question (onClick)

4. Call Recording on Android 2.3

5. Query in calling SOAP based web service in Android

6. How can I re-init the screen

7. times_contacted not being updated on some devices