MediaController is not working properly with MediaPlayer

by manoj » Mon, 22 Jun 2009 14:38:02 GMT


Sponsored Links
 i,

I want to enable the MediaController for the MediaPlayer.

For this I have written the code like this:

public class AudioPlayerNew extends Activity implements
MediaPlayerControl,MediaPlayer.OnPreparedListener,MediaPlayer.OnBufferingUpdateListener
{
MediaController mediaController;
MediaPlayer mMediaPlayer;
private String path = "/sdcard/Kaarulo Shikarukelle.mp3";
int percent = 1;
boolean playerState = true;

public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.sdcard_media_view);
mediaController = (MediaController) findViewById
(R.id.MediaController01);
playAudio(path);
mediaController.setAnchorView( findViewById
(R.layout.sdcard_media_view));
mediaController.setMediaPlayer(this);
mediaController.bringToFront();
mediaController.setEnabled(true);
}

private void playAudio(String media)
{
try
{
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(path);
mMediaPlayer.prepare();

mMediaPlayer.setOnSeekCompleteListener(this);

mMediaPlayer.setOnPreparedListener(this);

mMediaPlayer.setOnCompletionListener(this);

mMediaPlayer.setOnErrorListener(this);
}
catch (Exception e)
{
Log.e(TAG, "error: " + e.getMessage(), e);
}

}

@Override
protected void onDestroy() {
super.onDestroy();
// TODO Auto-generated method stub
dismissDialog();
if(null != mMediaPlayer)
{
mMediaPlayer.release();
mMediaPlayer = null;
}


wakeLock.release();
}

@Override
public int getBufferPercentage() {
System.out.println("MediaController.getBufferPercentage()
called!!!");
// TODO Auto-generated method stub
return percent;
}

@Override
public int getCurrentPosition() {
System.out.println("MediaController.getCurrentPosition()
called!!!");
// TODO Auto-generated method stub
return mMediaPlayer.getCurrentPosition();
}

@Override
public int getDuration() {
System.out.println("MediaController.getDuration() called!!!");
// TODO Auto-generated method stub
return mMediaPlayer.getDuration();
}

@Override
public boolean isPlaying()
{
//System.out.println("MediaController.isPlaying() called!!!");
// TODO Auto-generated method stub
return playerState;
}

@Override
public void pause()
{
//System.out.println("MediaController.pause() called!!!");
// TODO Auto-generated method stub
if(null != mMediaPlayer)
{
mMediaPlayer.pause();



MediaController is not working properly with MediaPlayer

by manoj » Mon, 22 Jun 2009 17:26:46 GMT


 i, why can't my seek bar (with time) is not updating according to
mediaplayer time.

Can any one please help me.

Thanks,
Manoj.

On Jun 22, 11:37am, manoj <manojkumar.m...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


MediaController is not working properly with MediaPlayer

by manoj » Mon, 22 Jun 2009 19:48:22 GMT


 inally, I solved it!!!

On Jun 22, 2:26pm, manoj <manojkumar.m...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



MediaController is not working properly with MediaPlayer

by plun » Mon, 27 Jul 2009 06:45:59 GMT


 i Manoj,

I'm having trouble with this too. How did you get it working?
(The Mediacontroller won't display on the Mediaplayer)

On Jun 22, 4:48am, manoj <manojkumar.m...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. SIP Stack

Hi

When I went through the document "opencore_framework_capabilities.pdf"
I came to know that Android supports RTP streaming for 3gpp format.

After doing a anaysis I found that the data from a server could be
streamed to the android device and played back. i.e the RTP payloads
sent from the server are parsed by the Android device and sent to the
decoder for playback.

1. I want to know if it is possible that the PCM data captured from a
camera and then encoded using a particular encoder could be streamed
using  RTP from  android code i.e is RTP sender support present in the
Android code ?. If not then can someone please mention what could be
the possible modifications required.

2. Does Android code support SIP stack ?.

Thanks

-- 

2. froyo branch - public now

check for froyo head -
http://android.git.kernel.org/?p=platform/manifest.git;a=summary
\m/

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Why does booting time reduce from 2 min to 1 min after just adding a printk(..) invoking?

4. Help - Kernel branches omap, common branches are not syncing for fresh downloads?

5. Help to map kernel branch for Master branch (git://android.git.kernel.org/platform/manifest.git) code

6. Mod: Thanks to Boss Iskandar gilaoriginal @ Surabaya

7. How can I kill a activity from surfaceview which belongs to the activity