Example usage for Java android.media MediaPlayer fields, constructors, methods, implement or subclass
The text is from its open source code.
int | VIDEO_SCALING_MODE_SCALE_TO_FIT Specifies a video scaling mode. |
int | MEDIA_ERROR_UNKNOWN Unspecified media player error. |
int | MEDIA_ERROR_SERVER_DIED Media server died. |
int | MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK The video is streamed and its container is not valid for progressive playback i.e the video's index (e.g moov atom) is not at the start of the file. |
int | MEDIA_ERROR_IO File or network related operation errors. |
int | MEDIA_ERROR_MALFORMED Bitstream is not conforming to the related coding standard or file spec. |
int | MEDIA_ERROR_UNSUPPORTED Bitstream is conforming to the related coding standard or file spec, but the media framework does not support the feature. |
int | MEDIA_ERROR_TIMED_OUT Some operation takes too long to complete, usually more than 3-5 seconds. |
int | MEDIA_INFO_UNKNOWN Unspecified media player info. |
int | MEDIA_INFO_VIDEO_RENDERING_START The player just pushed the very first video frame for rendering. |
int | MEDIA_INFO_VIDEO_TRACK_LAGGING The video is too complex for the decoder: it can't decode frames fast enough. |
int | MEDIA_INFO_BUFFERING_START MediaPlayer is temporarily pausing playback internally in order to buffer more data. |
int | MEDIA_INFO_BUFFERING_END MediaPlayer is resuming playback after filling buffers. |
int | MEDIA_INFO_BAD_INTERLEAVING Bad interleaving means that a media has been improperly interleaved or not interleaved at all, e.g has all the video samples first then all the audio ones. |
int | MEDIA_INFO_NOT_SEEKABLE The media cannot be seeked (e.g live stream) |
int | MEDIA_INFO_METADATA_UPDATE A new set of metadata is available. |
int | MEDIA_INFO_UNSUPPORTED_SUBTITLE Subtitle track was not supported by the media framework. |
int | MEDIA_INFO_SUBTITLE_TIMED_OUT Reading the subtitle track takes too long. |
MediaPlayer() Default constructor. |
MediaPlayer | create(Context context, Uri uri) Convenience method to create a MediaPlayer for a given Uri. |
MediaPlayer | create(Context context, int resid) Convenience method to create a MediaPlayer for a given resource id. |
MediaPlayer | create(Context context, int resid, AudioAttributes audioAttributes, int audioSessionId) Same factory method as #create(Context,int) but that lets you specify the audio attributes and session ID to be used by the new MediaPlayer instance. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
int | getAudioSessionId() Returns the audio session ID. |
int | getCurrentPosition() Gets the current playback position. |
int | getDuration() Gets the duration of the file. |
PlaybackParams | getPlaybackParams() Gets the playback params, containing the current playback rate. |
int | getVideoHeight() Returns the height of the video. |
int | getVideoWidth() Returns the width of the video. |
boolean | isLooping() Checks whether the MediaPlayer is looping or non-looping. |
boolean | isPlaying() Checks whether the MediaPlayer is playing. |
void | pause() Pauses playback. |
void | prepare() Prepares the player for playback, synchronously. |
void | prepareAsync() Prepares the player for playback, asynchronously. |
void | release() Releases resources associated with this MediaPlayer object. |
void | reset() Resets the MediaPlayer to its uninitialized state. |
void | seekTo(int msec) Seeks to specified time position. |
void | setAudioSessionId(int sessionId) Sets the audio session ID. |
void | setAudioStreamType(int streamtype) Sets the audio stream type for this MediaPlayer. |
void | setDataSource(String path) Sets the data source (file-path or http/rtsp URL) to use. |
void | setDataSource(@NonNull AssetFileDescriptor afd) Sets the data source (AssetFileDescriptor) to use. |
void | setDataSource(FileDescriptor fd) Sets the data source (FileDescriptor) to use. |
void | setDataSource(MediaDataSource dataSource) Sets the data source (MediaDataSource) to use. |
void | setDataSource(@NonNull Context context, @NonNull Uri uri) Sets the data source as a content Uri. |
void | setDataSource(String path, Map Sets the data source (file-path or http/rtsp URL) to use. |
void | setDataSource(@NonNull Context context, @NonNull Uri uri, @Nullable Map Sets the data source as a content Uri. |
void | setDataSource(String path, Map |
void | setDataSource(FileDescriptor fd, long offset, long length) Sets the data source (FileDescriptor) to use. |
void | setDisplay(SurfaceHolder sh) Sets the SurfaceHolder to use for displaying the video portion of the media. |
void | setLooping(boolean looping) Sets the player to be looping or non-looping. |
void | setNextMediaPlayer(MediaPlayer next) Set the MediaPlayer to start when this MediaPlayer finishes playback (i.e. |
void | setOnBufferingUpdateListener(OnBufferingUpdateListener listener) Register a callback to be invoked when the status of a network stream's buffer has changed. |
void | setOnCompletionListener(OnCompletionListener listener) Register a callback to be invoked when the end of a media source has been reached during playback. |
void | setOnErrorListener(OnErrorListener listener) Register a callback to be invoked when an error has happened during an asynchronous operation. |
void | setOnInfoListener(OnInfoListener listener) Register a callback to be invoked when an info/warning is available. |
void | setOnPreparedListener(OnPreparedListener listener) Register a callback to be invoked when the media source is ready for playback. |
void | setOnSeekCompleteListener(OnSeekCompleteListener listener) Register a callback to be invoked when a seek operation has been completed. |
void | setOnVideoSizeChangedListener(OnVideoSizeChangedListener listener) Register a callback to be invoked when the video size is known or updated. |
void | setPlaybackParams(@NonNull PlaybackParams params) Sets playback rate using PlaybackParams . |
void | setSurface(Surface surface) Sets the Surface to be used as the sink for the video portion of the media. |
void | setVolume(float leftVolume, float rightVolume) Sets the volume on this player. |
void | setWakeMode(Context context, int mode) Set the low-level power management behavior for this MediaPlayer. |
void | start() Starts or resumes playback. |
void | stop() Stops playback after playback has been started or paused. |