android.media
Class MediaPlayer

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

public class MediaPlayer
extends java.lang.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_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
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 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 setAudioStreamType(int streamtype)
           
 void setDataSource(Context context, Uri uri)
           
 void setDataSource(java.io.FileDescriptor fd)
           
 void setDataSource(java.io.FileDescriptor fd, long offset, long length)
           
 void setDataSource(java.lang.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 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_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)

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 java.io.IOException,
                          java.lang.IllegalArgumentException,
                          java.lang.SecurityException,
                          java.lang.IllegalStateException
Throws:
java.io.IOException
java.lang.IllegalArgumentException
java.lang.SecurityException
java.lang.IllegalStateException

setDataSource

public void setDataSource(java.lang.String path)
                   throws java.io.IOException,
                          java.lang.IllegalArgumentException,
                          java.lang.IllegalStateException
Throws:
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IllegalStateException

setDataSource

public void setDataSource(java.io.FileDescriptor fd)
                   throws java.io.IOException,
                          java.lang.IllegalArgumentException,
                          java.lang.IllegalStateException
Throws:
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IllegalStateException

setDataSource

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

prepare

public void prepare()
             throws java.io.IOException,
                    java.lang.IllegalStateException
Throws:
java.io.IOException
java.lang.IllegalStateException

prepareAsync

public void prepareAsync()
                  throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

start

public void start()
           throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

stop

public void stop()
          throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

pause

public void pause()
           throws java.lang.IllegalStateException
Throws:
java.lang.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 java.lang.IllegalStateException
Throws:
java.lang.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)

finalize

protected void finalize()
Overrides:
finalize in class java.lang.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-2010. All Rights Reserved.