public class MediaPlayer extends Object
| Modifier and Type | Class and Description |
|---|---|
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.OnTimedTextListener |
static interface |
MediaPlayer.OnVideoSizeChangedListener |
static class |
MediaPlayer.TrackInfo |
| Modifier and Type | Field and Description |
|---|---|
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 |
static String |
MEDIA_MIMETYPE_TEXT_SUBRIP |
static int |
VIDEO_SCALING_MODE_SCALE_TO_FIT |
static int |
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING |
| Constructor and Description |
|---|
MediaPlayer() |
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
public static final String MEDIA_MIMETYPE_TEXT_SUBRIP
public static final int MEDIA_ERROR_UNKNOWN
public static final int MEDIA_ERROR_SERVER_DIED
public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK
public static final int MEDIA_INFO_UNKNOWN
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING
public static final int MEDIA_INFO_BUFFERING_START
public static final int MEDIA_INFO_BUFFERING_END
public static final int MEDIA_INFO_BAD_INTERLEAVING
public static final int MEDIA_INFO_NOT_SEEKABLE
public static final int MEDIA_INFO_METADATA_UPDATE
public void setDisplay(SurfaceHolder sh)
public void setSurface(Surface surface)
public void setVideoScalingMode(int mode)
public static MediaPlayer create(Context context, Uri uri)
public static MediaPlayer create(Context context, Uri uri, SurfaceHolder holder)
public static MediaPlayer create(Context context, int resid)
public void setDataSource(Context context, Uri uri) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException
public void setDataSource(Context context, Uri uri, Map<String,String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException
public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException
public void setDataSource(FileDescriptor fd) throws IOException, IllegalArgumentException, IllegalStateException
public void setDataSource(FileDescriptor fd, long offset, long length) throws IOException, IllegalArgumentException, IllegalStateException
public void prepare()
throws IOException,
IllegalStateException
IOExceptionIllegalStateExceptionpublic void prepareAsync()
throws IllegalStateException
IllegalStateExceptionpublic void start()
throws IllegalStateException
IllegalStateExceptionpublic void stop()
throws IllegalStateException
IllegalStateExceptionpublic void pause()
throws IllegalStateException
IllegalStateExceptionpublic void setWakeMode(Context context, int mode)
public void setScreenOnWhilePlaying(boolean screenOn)
public int getVideoWidth()
public int getVideoHeight()
public boolean isPlaying()
public void seekTo(int msec)
throws IllegalStateException
IllegalStateExceptionpublic int getCurrentPosition()
public int getDuration()
public void setNextMediaPlayer(MediaPlayer next)
public void release()
public void reset()
public void setAudioStreamType(int streamtype)
public void setLooping(boolean looping)
public boolean isLooping()
public void setVolume(float leftVolume,
float rightVolume)
public void setAudioSessionId(int sessionId)
throws IllegalArgumentException,
IllegalStateException
public int getAudioSessionId()
public void attachAuxEffect(int effectId)
public void setAuxEffectSendLevel(float level)
public MediaPlayer.TrackInfo[] getTrackInfo() throws IllegalStateException
IllegalStateExceptionpublic void addTimedTextSource(String path, String mimeType) throws IOException, IllegalArgumentException, IllegalStateException
public void addTimedTextSource(Context context, Uri uri, String mimeType) throws IOException, IllegalArgumentException, IllegalStateException
public void addTimedTextSource(FileDescriptor fd, String mimeType) throws IllegalArgumentException, IllegalStateException
public void addTimedTextSource(FileDescriptor fd, long offset, long length, String mimeType) throws IllegalArgumentException, IllegalStateException
public void selectTrack(int index)
throws IllegalStateException
IllegalStateExceptionpublic void deselectTrack(int index)
throws IllegalStateException
IllegalStateExceptionpublic void setOnPreparedListener(MediaPlayer.OnPreparedListener listener)
public void setOnCompletionListener(MediaPlayer.OnCompletionListener listener)
public void setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)
public void setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)
public void setOnVideoSizeChangedListener(MediaPlayer.OnVideoSizeChangedListener listener)
public void setOnTimedTextListener(MediaPlayer.OnTimedTextListener listener)
public void setOnErrorListener(MediaPlayer.OnErrorListener listener)
public void setOnInfoListener(MediaPlayer.OnInfoListener listener)
Copyright © 2008-2013. All Rights Reserved.