Hi,

I've been starting to use the MediaController in combination with the
MediaPlayer. Besides finding out some documented weird behaviour (like
if you create a MediaController from XML the show()/hide() don't do
anything but they do work if you create the controller via code), I
did find some undocumented (AFAICT) buggy? behaviour. Here it goes:

1) Why is the mediacontroller too wide by default, that is when all
buttons are showing (which is the case when you create it from XML)?
See screenshot here: 
http://www.4shared.com/photo/ogbrAo4H/mediacontroller_toowide_2010-0.html
The |< and >| are cut off!
Even on a real Nexus One it's too wide, only in landscape it fits
(easily; it doesn't get stretched full width either)
If I add paddingLeft and right to the wrapping LinearLayout, the left
& right of the mediacontroller are just cut off.
If I add paddingLeft and right to the MediaController xml, the left &
right of the mediacontroller are also just cut off.
If I change the width of the MediaController view in the XML to 200dip
it just gets cut off.
Apparently the controller is not made resolution independent using
dips etc? Or can I do something to make it fit? For now I take out the
<< and >>, the user can seek with the slider too...

2) Why is it called a floating window (at least in its
implementation), I can't seem to be able to move it around. Floating
is meant here only as: it is on top of something?

3) It seems you really need to wait a bit before calling
controller.show() because otherwise something is not ready yet (I get
something like window null - Activity not started error). Is this
true? Is there a better way to do it than postDelayed as mentioned in
this post: 
http://stackoverflow.com/questions/1759862/how-can-i-get-an-android-mediacontroller-to-appear-from-layout-xml?

4) It seems getBufferPercentage() only gets called when you press a
button on the control? I do see the mediaplayer's onBufferingUpdate()
getting called in the example below, but getBufferPercentage only when
I touch a button on the MediaController:

  controller.setMediaPlayer(new MediaController.MediaPlayerControl() {
    public int getBufferPercentage() {
      return bufferedPercentage;
    }
    public int getCurrentPosition() {
      return mediaPlayer.getCurrentPosition();
    }
    public int getDuration() {
      return mediaPlayer.getDuration();
    }
    public boolean isPlaying() {return mediaPlayer.isPlaying();}
    public void pause() {
      mediaPlayer.pause();
    }
    public void seekTo(int pos) {}
      public void start() {
      mediaPlayer.start();
    }
  });

Any ideas why it's not being called? My workaround for now is to do a
controller.show() call in mediaPlayer.onBufferingUpdate().

5) This I found out by experience and seems to me incorrect in the
docs here: 
http://developer.android.com/reference/android/widget/MediaController.html
I read the bottom 3 statements as: no prev/next buttons are shown if
setPrevNextListeners() is not being called.
But when creating the controller via XML they are shown disabled,
though I'm sure not having called setPrevNextListeners().

6) In 1.6 the slider knob is showing correctly at starting and ending
point, see screenshot for starting point (note that the stream as been
loaded, but whether it's loaded or not has no impact):
http://www.4shared.com/photo/FeK1kxXT/mediacontroller_slider_sdk16_s.html
But in 2.1 the slider know is slightly hidden under "something" on the
left and "something"  on the right, see screenshots:
http://www.4shared.com/photo/UH5jHyMd/mediacontroller_slider_sdk21_b.html
http://www.4shared.com/photo/8chC5_Q5/mediacontroller_slider_sdk21_b.html
Seems a bug to me. Or can I do something about this?
BTW: the correct position in 2.1 seems to be about 4secs into the
track, see this screenshot:
http://www.4shared.com/photo/fbM-PNJ1/mediacontroller_slider_sdk21_o.html

7): Why is the downloading of an mp3 from the internet (via a URL)
starting all over again when I drag the slider all the way to the left
(i.e 0)? Seems not necessary, and will make the user have to wait
again for the download.

8) In 1.6 it was fine to call controller.setEnabled(true) before
controller.setMediaPlayer(), but definitely in 2.1 it is not allowed
anymore, you get a NullpointerException. If you check the
MediaController source code, you'll see it's calling a mediaPlayer
method w/o checking for null.

Hope somebody can provide some input on these!

Regards,
Marco






-- 
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