android.media
Class MediaPlayer
java.lang.Object
android.media.MediaPlayer
public class MediaPlayer
- extends Object
|
Method Summary |
void |
addTimedTextSource(Context context,
Uri uri,
String mimeType)
|
void |
addTimedTextSource(FileDescriptor fd,
long offset,
long length,
String mimeType)
|
void |
addTimedTextSource(FileDescriptor fd,
String mimeType)
|
void |
addTimedTextSource(String path,
String mimeType)
|
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)
|
void |
deselectTrack(int index)
|
protected void |
finalize()
|
int |
getAudioSessionId()
|
int |
getCurrentPosition()
|
int |
getDuration()
|
MediaPlayer.TrackInfo[] |
getTrackInfo()
|
int |
getVideoHeight()
|
int |
getVideoWidth()
|
boolean |
isLooping()
|
boolean |
isPlaying()
|
void |
pause()
|
void |
prepare()
|
void |
prepareAsync()
|
void |
release()
|
void |
reset()
|
void |
seekTo(int msec)
|
void |
selectTrack(int index)
|
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 |
setNextMediaPlayer(MediaPlayer next)
|
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 |
setOnTimedTextListener(MediaPlayer.OnTimedTextListener listener)
|
void |
setOnVideoSizeChangedListener(MediaPlayer.OnVideoSizeChangedListener listener)
|
void |
setScreenOnWhilePlaying(boolean screenOn)
|
void |
setSurface(Surface surface)
|
void |
setVideoScalingMode(int mode)
|
void |
setVolume(float leftVolume,
float rightVolume)
|
void |
setWakeMode(Context context,
int mode)
|
void |
start()
|
void |
stop()
|
VIDEO_SCALING_MODE_SCALE_TO_FIT
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT
- See Also:
- Constant Field Values
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
- See Also:
- Constant Field Values
MEDIA_MIMETYPE_TEXT_SUBRIP
public static final String MEDIA_MIMETYPE_TEXT_SUBRIP
- See Also:
- Constant Field Values
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
MediaPlayer
public MediaPlayer()
setDisplay
public void setDisplay(SurfaceHolder sh)
setSurface
public void setSurface(Surface surface)
setVideoScalingMode
public void setVideoScalingMode(int mode)
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()
setNextMediaPlayer
public void setNextMediaPlayer(MediaPlayer next)
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)
getTrackInfo
public MediaPlayer.TrackInfo[] getTrackInfo()
throws IllegalStateException
- Throws:
IllegalStateException
addTimedTextSource
public void addTimedTextSource(String path,
String mimeType)
throws IOException,
IllegalArgumentException,
IllegalStateException
- Throws:
IOException
IllegalArgumentException
IllegalStateException
addTimedTextSource
public void addTimedTextSource(Context context,
Uri uri,
String mimeType)
throws IOException,
IllegalArgumentException,
IllegalStateException
- Throws:
IOException
IllegalArgumentException
IllegalStateException
addTimedTextSource
public void addTimedTextSource(FileDescriptor fd,
String mimeType)
throws IllegalArgumentException,
IllegalStateException
- Throws:
IllegalArgumentException
IllegalStateException
addTimedTextSource
public void addTimedTextSource(FileDescriptor fd,
long offset,
long length,
String mimeType)
throws IllegalArgumentException,
IllegalStateException
- Throws:
IllegalArgumentException
IllegalStateException
selectTrack
public void selectTrack(int index)
throws IllegalStateException
- Throws:
IllegalStateException
deselectTrack
public void deselectTrack(int index)
throws IllegalStateException
- Throws:
IllegalStateException
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)
setOnTimedTextListener
public void setOnTimedTextListener(MediaPlayer.OnTimedTextListener listener)
setOnErrorListener
public void setOnErrorListener(MediaPlayer.OnErrorListener listener)
setOnInfoListener
public void setOnInfoListener(MediaPlayer.OnInfoListener listener)
Copyright © 2008-2012. All Rights Reserved.