Android MediaPlayer
来源:互联网 发布:c语言数组程序设计例题 编辑:程序博客网 时间:2024/05/11 18:16
Method NameValid SatesInvalid StatesCommentsattachAuxEffect{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Idle, Error}This method must be called after setDataSource. Calling it does not change the object state.getAudioSessionIdany{}This method can be called in any state and calling it does not change the object state.getCurrentPosition{Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.getDuration{Prepared, Started, Paused, Stopped, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.getVideoHeight{Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.getVideoWidth{Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.isPlaying{Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.pause{Started, Paused, PlaybackCompleted}{Idle, Initialized, Prepared, Stopped, Error}Successful invoke of this method in a valid state transfers the object to the Paused state. Calling this method in an invalid state transfers the object to the Error state.prepare{Initialized, Stopped}{Idle, Prepared, Started, Paused, PlaybackCompleted, Error}Successful invoke of this method in a valid state transfers the object to the Prepared state. Calling this method in an invalid state throws an IllegalStateException.prepareAsync{Initialized, Stopped}{Idle, Prepared, Started, Paused, PlaybackCompleted, Error}Successful invoke of this method in a valid state transfers the object to the Preparing state. Calling this method in an invalid state throws an IllegalStateException.releaseany{}After Public Methods void addTimedTextSource(Context context, Uri uri, String mimeType) void addTimedTextSource(String path, String mimeType) void addTimedTextSource(FileDescriptor fd, long offset, long length, String mimeType) void addTimedTextSource(FileDescriptor fd, String mimeType) void attachAuxEffect(int effectId) static MediaPlayer create(Context context, Uri uri, SurfaceHolder holder) static MediaPlayer create(Context context, int resid) static MediaPlayer create(Context context, Uri uri) void deselectTrack(int index) int getAudioSessionId() int getCurrentPosition() int getDuration() 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(String path) void setDataSource(Context context, Uri uri, Map<String, String> headers) void setDataSource(Context context, Uri uri) void setDataSource(FileDescriptor fd, long offset, long length) void setDataSource(FileDescriptor fd) 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()
release()
, the object is no longer available.reset{Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, Error}{}After reset()
, the object is like being just created.seekTo{Prepared, Started, Paused, PlaybackCompleted}{Idle, Initialized, Stopped, Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.setAudioSessionId{Idle}{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, Error}This method must be called in idle state as the audio session ID must be known before calling setDataSource. Calling it does not change the object state.setAudioStreamType{Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackCompleted}{Error}Successful invoke of this method does not change the state. In order for the target audio stream type to become effective, this method must be called before prepare() or prepareAsync().setAuxEffectSendLevelany{}Calling this method does not change the object state.setDataSource{Idle}{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, Error}Successful invoke of this method in a valid state transfers the object to the Initialized state. Calling this method in an invalid state throws an IllegalStateException.setDisplayany{}This method can be called in any state and calling it does not change the object state.setSurfaceany{}This method can be called in any state and calling it does not change the object state.setVideoScalingMode{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}{Idle, Error}Successful invoke of this method does not change the state.setLooping{Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackCompleted}{Error}Successful invoke of this method in a valid state does not change the state. Calling this method in an invalid state transfers the object to the Error state.isLoopingany{}This method can be called in any state and calling it does not change the object state.setOnBufferingUpdateListenerany{}This method can be called in any state and calling it does not change the object state.setOnCompletionListenerany{}This method can be called in any state and calling it does not change the object state.setOnErrorListenerany{}This method can be called in any state and calling it does not change the object state.setOnPreparedListenerany{}This method can be called in any state and calling it does not change the object state.setOnSeekCompleteListenerany{}This method can be called in any state and calling it does not change the object state.setScreenOnWhilePlayingany{}This method can be called in any state and calling it does not change the object state.setVolume{Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackCompleted}{Error}Successful invoke of this method does not change the state.setWakeModeany{}This method can be called in any state and calling it does not change the object state.start{Prepared, Started, Paused, PlaybackCompleted}{Idle, Initialized, Stopped, Error}Successful invoke of this method in a valid state transfers the object to the Started state. Calling this method in an invalid state transfers the object to the Error state.stop{Prepared, Started, Stopped, Paused, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method in a valid state transfers the object to the Stopped state. Calling this method in an invalid state transfers the object to the Error state.getTrackInfo{Prepared, Started, Stopped, Paused, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method does not change the state.addTimedTextSource{Prepared, Started, Stopped, Paused, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method does not change the state.selectTrack{Prepared, Started, Stopped, Paused, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method does not change the state.deselectTrack{Prepared, Started, Stopped, Paused, PlaybackCompleted}{Idle, Initialized, Error}Successful invoke of this method does not change the state.Adds an external timed text source file (Uri).
Adds an external timed text source file.
Adds an external timed text file (FileDescriptor).
Adds an external timed text source file (FileDescriptor).
Attaches an auxiliary effect to the player.
Convenience method to create a MediaPlayer for a given Uri.
Convenience method to create a MediaPlayer for a given resource id.
Convenience method to create a MediaPlayer for a given Uri.
Deselect a track.
Returns the audio session ID.
Gets the current playback position.
Gets the duration of the file.
Returns an array of track information.
Returns the height of the video.
Returns the width of the video.
Checks whether the MediaPlayer is looping or non-looping.
Checks whether the MediaPlayer is playing.
Pauses playback.
Prepares the player for playback, synchronously.
Prepares the player for playback, asynchronously.
Releases resources associated with this MediaPlayer object.
Resets the MediaPlayer to its uninitialized state.
Seeks to specified time position.
Selects a track.
Sets the audio session ID.
Sets the audio stream type for this MediaPlayer.
Sets the send level of the player to the attached auxiliary effect .
Sets the data source (file-path or http/rtsp URL) to use.
Sets the data source as a content Uri.
Sets the data source as a content Uri.
Sets the data source (FileDescriptor) to use.
Sets the data source (FileDescriptor) to use.
Sets the
SurfaceHolder
to use for displaying the video portion of the media.Sets the player to be looping or non-looping.
Set the MediaPlayer to start when this MediaPlayer finishes playback (i.e.
Register a callback to be invoked when the status of a network stream's buffer has changed.
Register a callback to be invoked when the end of a media source has been reached during playback.
Register a callback to be invoked when an error has happened during an asynchronous operation.
Register a callback to be invoked when an info/warning is available.
Register a callback to be invoked when the media source is ready for playback.
Register a callback to be invoked when a seek operation has been completed.
Register a callback to be invoked when a timed text is available for display.
Register a callback to be invoked when the video size is known or updated.
Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring.
Sets the
Surface
to be used as the sink for the video portion of the media.Sets video scaling mode.
Sets the volume on this player.
Set the low-level power management behavior for this MediaPlayer.
Starts or resumes playback.
Stops playback after playback has been stopped or paused.
0 0
- [MediaPlayer] Android MediaPlayer
- Android MediaPlayer
- android mediaplayer
- android mediaplayer
- Android MediaPlayer
- android MediaPlayer
- Android MediaPlayer .
- android MediaPlayer
- Android MediaPlayer
- Android MediaPlayer
- Android MediaPlayer .
- Android mediaplayer
- android:MediaPlayer
- android MediaPlayer
- android MediaPlayer
- Android MediaPlayer
- Android MediaPlayer
- Android mediaplayer
- 串结构练习——字符串匹配
- linux 技巧:使用 screen 管理你的远程会话
- 【微信公众平台开发】接口接入,成为开发者(二)
- awk 学习
- 年前整理的C#规范
- Android MediaPlayer
- 第一章 Spring MVC 4概述
- 狮子与狼的故事
- 【转】 android cts failed items
- OCP-1Z0-053-200题-83题-146
- 【Android】 JNI入门 - NDK从入门到精通
- 开发者如何制作未签名的ipa
- 百万用户级游戏服务器架构设计(1)
- android 各种对话框的用法