android.media
Class MediaPlayer

java.lang.Object
  extended by android.media.MediaPlayer

public class MediaPlayer
extends Object


Nested Class Summary
static interface MediaPlayer.OnBufferingUpdateListener
           
static interface MediaPlayer.OnCompletionListener
           
static interface MediaPlayer.OnErrorListener
           
static interface MediaPlayer.OnInfoListener
           
static interface MediaPlayer.OnPreparedListener
           
static interface MediaPlayer.OnSeekCompleteListener
           
static interface MediaPlayer.OnVideoSizeChangedListener
           
 
Field Summary
static int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK
           
static int MEDIA_ERROR_SERVER_DIED
           
static int MEDIA_ERROR_UNKNOWN
           
static int MEDIA_INFO_BAD_INTERLEAVING
           
static int MEDIA_INFO_BUFFERING_END
           
static int MEDIA_INFO_BUFFERING_START
           
static int MEDIA_INFO_METADATA_UPDATE
           
static int MEDIA_INFO_NOT_SEEKABLE
           
static int MEDIA_INFO_UNKNOWN
           
static int MEDIA_INFO_VIDEO_TRACK_LAGGING
           
 
Constructor Summary
MediaPlayer()
           
 
Method Summary
 void attachAuxEffect(int effectId)
           
static MediaPlayer create(Context context, int resid)
           
static MediaPlayer create(Context context, Uri uri)
           
static MediaPlayer create(Context context, Uri uri, SurfaceHolder holder)
           
protected  void finalize()
           
 int getAudioSessionId()
           
 int getCurrentPosition()
           
 int getDuration()
           
 int getVideoHeight()
           
 int getVideoWidth()
           
 boolean isLooping()
           
 boolean isPlaying()
           
 void pause()
           
 void prepare()
           
 void prepareAsync()
           
 void release()
           
 void reset()
           
 void seekTo(int msec)
           
 void setAudioSessionId(int sessionId)
           
 void setAudioStreamType(int streamtype)
           
 void setAuxEffectSendLevel(float level)
           
 void setDataSource(Context context, Uri uri)
           
 void setDataSource(Context context, Uri uri, Map<String,String> headers)
           
 void setDataSource(FileDescriptor fd)
           
 void setDataSource(FileDescriptor fd, long offset, long length)
           
 void setDataSource(String path)
           
 void setDisplay(SurfaceHolder sh)
           
 void setLooping(boolean looping)
           
 void setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)
           
 void setOnCompletionListener(MediaPlayer.OnCompletionListener listener)
           
 void setOnErrorListener(MediaPlayer.OnErrorListener listener)
           
 void setOnInfoListener(MediaPlayer.OnInfoListener listener)
           
 void setOnPreparedListener(MediaPlayer.OnPreparedListener listener)
           
 void setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)
           
 void setOnVideoSizeChangedListener(MediaPlayer.OnVideoSizeChangedListener listener)
           
 void setScreenOnWhilePlaying(boolean screenOn)
           
 void setSurface(Surface surface)
           
 void setVolume(float leftVolume, float rightVolume)
           
 void setWakeMode(Context context, int mode)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEDIA_ERROR_UNKNOWN

public static final int MEDIA_ERROR_UNKNOWN
See Also:
Constant Field Values

MEDIA_ERROR_SERVER_DIED

public static final int MEDIA_ERROR_SERVER_DIED
See Also:
Constant Field Values

MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK
See Also:
Constant Field Values

MEDIA_INFO_UNKNOWN

public static final int MEDIA_INFO_UNKNOWN
See Also:
Constant Field Values

MEDIA_INFO_VIDEO_TRACK_LAGGING

public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING
See Also:
Constant Field Values

MEDIA_INFO_BUFFERING_START

public static final int MEDIA_INFO_BUFFERING_START
See Also:
Constant Field Values

MEDIA_INFO_BUFFERING_END

public static final int MEDIA_INFO_BUFFERING_END
See Also:
Constant Field Values

MEDIA_INFO_BAD_INTERLEAVING

public static final int MEDIA_INFO_BAD_INTERLEAVING
See Also:
Constant Field Values

MEDIA_INFO_NOT_SEEKABLE

public static final int MEDIA_INFO_NOT_SEEKABLE
See Also:
Constant Field Values

MEDIA_INFO_METADATA_UPDATE

public static final int MEDIA_INFO_METADATA_UPDATE
See Also:
Constant Field Values
Constructor Detail

MediaPlayer

public MediaPlayer()
Method Detail

setDisplay

public void setDisplay(SurfaceHolder sh)

setSurface

public void setSurface(Surface surface)

create

public static MediaPlayer create(Context context,
                                 Uri uri)

create

public static MediaPlayer create(Context context,
                                 Uri uri,
                                 SurfaceHolder holder)

create

public static MediaPlayer create(Context context,
                                 int resid)

setDataSource

public void setDataSource(Context context,
                          Uri uri)
                   throws IOException,
                          IllegalArgumentException,
                          SecurityException,
                          IllegalStateException
Throws:
IOException
IllegalArgumentException
SecurityException
IllegalStateException

setDataSource

public void setDataSource(Context context,
                          Uri uri,
                          Map<String,String> headers)
                   throws IOException,
                          IllegalArgumentException,
                          SecurityException,
                          IllegalStateException
Throws:
IOException
IllegalArgumentException
SecurityException
IllegalStateException

setDataSource

public void setDataSource(String path)
                   throws IOException,
                          IllegalArgumentException,
                          SecurityException,
                          IllegalStateException
Throws:
IOException
IllegalArgumentException
SecurityException
IllegalStateException

setDataSource

public void setDataSource(FileDescriptor fd)
                   throws IOException,
                          IllegalArgumentException,
                          IllegalStateException
Throws:
IOException
IllegalArgumentException
IllegalStateException

setDataSource

public void setDataSource(FileDescriptor fd,
                          long offset,
                          long length)
                   throws IOException,
                          IllegalArgumentException,
                          IllegalStateException
Throws:
IOException
IllegalArgumentException
IllegalStateException

prepare

public void prepare()
             throws IOException,
                    IllegalStateException
Throws:
IOException
IllegalStateException

prepareAsync

public void prepareAsync()
                  throws IllegalStateException
Throws:
IllegalStateException

start

public void start()
           throws IllegalStateException
Throws:
IllegalStateException

stop

public void stop()
          throws IllegalStateException
Throws:
IllegalStateException

pause

public void pause()
           throws IllegalStateException
Throws:
IllegalStateException

setWakeMode

public void setWakeMode(Context context,
                        int mode)

setScreenOnWhilePlaying

public void setScreenOnWhilePlaying(boolean screenOn)

getVideoWidth

public int getVideoWidth()

getVideoHeight

public int getVideoHeight()

isPlaying

public boolean isPlaying()

seekTo

public void seekTo(int msec)
            throws IllegalStateException
Throws:
IllegalStateException

getCurrentPosition

public int getCurrentPosition()

getDuration

public int getDuration()

release

public void release()

reset

public void reset()

setAudioStreamType

public void setAudioStreamType(int streamtype)

setLooping

public void setLooping(boolean looping)

isLooping

public boolean isLooping()

setVolume

public void setVolume(float leftVolume,
                      float rightVolume)

setAudioSessionId

public void setAudioSessionId(int sessionId)
                       throws IllegalArgumentException,
                              IllegalStateException
Throws:
IllegalArgumentException
IllegalStateException

getAudioSessionId

public int getAudioSessionId()

attachAuxEffect

public void attachAuxEffect(int effectId)

setAuxEffectSendLevel

public void setAuxEffectSendLevel(float level)

finalize

protected void finalize()
Overrides:
finalize in class Object

setOnPreparedListener

public void setOnPreparedListener(MediaPlayer.OnPreparedListener listener)

setOnCompletionListener

public void setOnCompletionListener(MediaPlayer.OnCompletionListener listener)

setOnBufferingUpdateListener

public void setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)

setOnSeekCompleteListener

public void setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)

setOnVideoSizeChangedListener

public void setOnVideoSizeChangedListener(MediaPlayer.OnVideoSizeChangedListener listener)

setOnErrorListener

public void setOnErrorListener(MediaPlayer.OnErrorListener listener)

setOnInfoListener

public void setOnInfoListener(MediaPlayer.OnInfoListener listener)


Copyright © 2008-2012. All Rights Reserved.