Hướng dẫn root android 4.0 4 Informational, Transactional

Fulton County offices and facilities will be closed on Monday, December 25 & Tuesday, December 26 in observance of the Holiday Season. Offices and facilities will reopen on Wednesday, December 27.

Show

Fulton County offices and facilities will be closed on Monday, December 25 & Tuesday, December 26 in observance of the Holiday Season. Offices and facilities will reopen on Wednesday, December 27.

Method Name Valid States Invalid States Comments attachAuxEffect {Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted} {Idle, Error} This method must be called after setDataSource. Calling it does not change the object state. getAudioSessionId any {} 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. release any {} After

public static final int MEDIA_ERROR_MALFORMED

12, you must not interact with the object. reset {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, Error} {} After

public static final int MEDIA_ERROR_MALFORMED

13, 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. setAudioAttributes {Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackCompleted} {Error} Successful invoke of this method does not change the state. In order for the target audio attributes type to become effective, this method must be called before prepare() or prepareAsync(). 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 (deprecated) {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(). setAuxEffectSendLevel any {} 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. setDisplay any {} This method can be called in any state and calling it does not change the object state. setSurface any {} 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. isLooping any {} This method can be called in any state and calling it does not change the object state. setOnBufferingUpdateListener any {} This method can be called in any state and calling it does not change the object state. setOnCompletionListener any {} This method can be called in any state and calling it does not change the object state. setOnErrorListener any {} This method can be called in any state and calling it does not change the object state. setOnPreparedListener any {} This method can be called in any state and calling it does not change the object state. setOnSeekCompleteListener any {} This method can be called in any state and calling it does not change the object state. setPlaybackParams {Initialized, Prepared, Started, Paused, PlaybackCompleted, Error} {Idle, Stopped} This method will change state in some cases, depending on when it's called. setScreenOnWhilePlaying any {} 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. setWakeMode any {} 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.

One may need to declare a corresponding WAKE_LOCK permission

public static final int MEDIA_ERROR_MALFORMED

14 element.

Applications may want to register for informational and error events in order to be informed of some internal state update and possible runtime errors during playback or streaming. Registration for these events is done by properly setting the appropriate listeners (via calls to

public static final int MEDIA_ERROR_MALFORMED

15,

public static final int MEDIA_ERROR_MALFORMED

16,

public static final int MEDIA_ERROR_MALFORMED

17,

public static final int MEDIA_ERROR_MALFORMED

18,

public static final int MEDIA_ERROR_MALFORMED

19,

public static final int MEDIA_ERROR_MALFORMED

20,

public static final int MEDIA_ERROR_MALFORMED

21, etc). In order to receive the respective callback associated with these listeners, applications are required to create MediaPlayer objects on a thread with its own Looper running (main UI thread by default has a Looper running).

Nested classes

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

23

Encapsulates the DRM properties of the source.

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

25

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

27

Thrown when a DRM method is called before preparing a DRM scheme through prepareDrm().

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

29

Interface definition of a callback to be invoked indicating buffering status of a media resource being streamed over the network.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

31

Interface definition for a callback to be invoked when playback of a media source has completed.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

33

Interface definition of a callback to be invoked when the app can do DRM configuration (get/set properties) before the session is opened.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

35

Interface definition of a callback to be invoked when the DRM info becomes available

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

37

Interface definition of a callback to notify the app when the DRM is ready for key request/response

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

39

Interface definition of a callback to be invoked when there has been an error during an asynchronous operation (other errors will throw exceptions at method call time).

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

41

Interface definition of a callback to be invoked to communicate some info and/or warning about the media or its playback.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

43

Interface definition of a callback to be invoked when discontinuity in the normal progression of the media time is detected.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

45

Interface definition for a callback to be invoked when the media source is ready for playback.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

47

Interface definition of a callback to be invoked indicating the completion of a seek operation.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

49

Interface definition of a callback to be invoked when a player subtitle track has new subtitle data available.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

51

Interface definition of a callback to be invoked when a track has timed metadata available.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

53

Interface definition of a callback to be invoked when a timed text is available for display.

public static final int MEDIA_ERROR_MALFORMED

28

public static final int MEDIA_ERROR_MALFORMED

55

Interface definition of a callback to be invoked when the video size is first known or updated

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

57

Thrown when the device requires DRM provisioning but the provisioning attempt has failed due to a network error (Internet reachability, timeout, etc.).

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

59

Thrown when the device requires DRM provisioning but the provisioning attempt has failed due to the provisioning server denying the request.

public static final int MEDIA_ERROR_MALFORMED

22

public static final int MEDIA_ERROR_MALFORMED

61

Class for MediaPlayer to return each audio/video/subtitle track's metadata.

Constants

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

63

File or network related operation errors.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

65

Bitstream is not conforming to the related coding standard or file spec.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

67

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.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

69

Media server died.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

71

Some operation takes too long to complete, usually more than 3-5 seconds.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

73

Unspecified media player error.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

75

Bitstream is conforming to the related coding standard or file spec, but the media framework does not support the feature.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

77

Informs that audio is not playing.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

79

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.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

81

MediaPlayer is resuming playback after filling buffers.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

83

MediaPlayer is temporarily pausing playback internally in order to buffer more data.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

85

A new set of metadata is available.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

87

The media cannot be seeked (e.g live stream)

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

89

The player was started because it was used as the next player for another player, which just completed playback.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

91

Reading the subtitle track takes too long.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

93

Unspecified media player info.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

95

Subtitle track was not supported by the media framework.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

97

Informs that video is not playing.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_MALFORMED

99

The player just pushed the very first video frame for rendering.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

01

The video is too complex for the decoder: it can't decode frames fast enough.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

02

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

03

This constant was deprecated in API level 28. use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

04

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

06

The DRM preparation has failed .

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

08

The device required DRM provisioning but couldn't reach the provisioning server.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

10

The device required DRM provisioning but the provisioning server denied the request.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

12

The status codes for

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

13 listener.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

15

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a frame (not necessarily a key frame) associated with a data source that is located closest to or at the given time.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

18

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located closest to (in time) or at the given time.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

21

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located right after or at the given time.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

24

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located right before or at the given time.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

27

Specifies a video scaling mode.

public static final int MEDIA_ERROR_MALFORMED

62

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

29

Specifies a video scaling mode.

Public constructors

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

30

Default constructor.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

31

Default constructor with context.

Public methods

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

33

Adds an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

34 to receive notifications of routing changes on this MediaPlayer.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

36

Adds an external timed text source file (FileDescriptor).

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

38

Adds an external timed text source file.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

40

Adds an external timed text file (FileDescriptor).

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

42

Adds an external timed text source file (Uri).

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

44

Attaches an auxiliary effect to the player.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

46

Clears the listener previously set with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

47 or

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

48

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

50

Clears the listener previously set with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

51 or

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

52.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

53

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

54

Same factory method as

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

55 but that lets you specify the audio attributes and session ID to be used by the new MediaPlayer instance.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

53

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

57

Same factory method as

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

58 but that lets you specify the audio attributes and session ID to be used by the new MediaPlayer instance.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

53

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

60

Convenience method to create a MediaPlayer for a given Uri.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

53

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

62

Convenience method to create a MediaPlayer for a given resource id.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

53

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

64

Convenience method to create a MediaPlayer for a given Uri.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

65

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

66

Returns a

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

67 object that can be used modify the volume envelope of the player or track.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

69

Deselect a track.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

71

Returns the audio session ID.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

73

Gets the current playback position.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

74

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

75

Retrieves the DRM Info associated with the current source

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

76

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

77

Read a DRM engine plugin String property value, given the property name string.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

79

Gets the duration of the file.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

80

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

81

A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

82

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

83

Return Metrics data about the current player.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

84

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

85

Gets the playback params, containing the current playback rate.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

86

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

87

Returns the selected output specified by

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

88.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

86

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

90

Returns an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 identifying the current routing of this MediaPlayer Note: The query is only valid if the MediaPlayer is currently playing.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

93

Returns the index of the audio, video, or subtitle track currently selected for playback, The return value is an index into the array returned by

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94, and can be used in calls to

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

95 or

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

96.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

97

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

98

Gets the A/V sync mode.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

99

public static final int MEDIA_ERROR_SERVER_DIED

00

Get current playback position as a

public static final int MEDIA_ERROR_SERVER_DIED

01.

public static final int MEDIA_ERROR_SERVER_DIED

02

public static final int MEDIA_ERROR_SERVER_DIED

03

Returns an array of track information.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_SERVER_DIED

05

Returns the height of the video.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_SERVER_DIED

07

Returns the width of the video.

public static final int MEDIA_ERROR_SERVER_DIED

08

public static final int MEDIA_ERROR_SERVER_DIED

09

Checks whether the MediaPlayer is looping or non-looping.

public static final int MEDIA_ERROR_SERVER_DIED

08

public static final int MEDIA_ERROR_SERVER_DIED

11

Checks whether the MediaPlayer is playing.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

13

Pauses playback.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

15

Prepares the player for playback, synchronously.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

17

Prepares the player for playback, asynchronously.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

19

Prepares the DRM for the current source

If

public static final int MEDIA_ERROR_SERVER_DIED

20 is registered, it will be called during preparation to allow configuration of the DRM properties before opening the DRM session.

public static final int MEDIA_ERROR_SERVER_DIED

21

public static final int MEDIA_ERROR_SERVER_DIED

22

A key response is received from the license server by the app, then it is provided to the DRM engine plugin using provideKeyResponse.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

24

Releases resources associated with this MediaPlayer object.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

26

Releases the DRM session

The player has to have an active DRM session and be in stopped, or prepared state before this call is made.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

28

Removes an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

34 which has been previously added to receive rerouting notifications.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

31

Resets the MediaPlayer to its uninitialized state.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

33

Restore persisted offline keys into a new session.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

35

Seeks to specified time position.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

37

Moves the media to specified time position by considering the given mode.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

39

Selects a track.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

41

Sets the audio attributes for this MediaPlayer.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

43

Sets the audio session ID.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

45

This method was deprecated in API level 26. use

public static final int MEDIA_ERROR_SERVER_DIED

46

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

48

Sets the send level of the player to the attached auxiliary effect.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

50

Sets the data source (AssetFileDescriptor) to use.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

52

Sets the data source (FileDescriptor) to use.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

54

Sets the data source (FileDescriptor) to use.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

56

Sets the data source (file-path or http/rtsp URL) to use.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

58

Sets the data source (MediaDataSource) to use.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

60

Sets the data source as a content Uri.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

62

Sets the data source as a content Uri.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

64

Sets the data source as a content Uri.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

66

Sets the

public static final int MEDIA_ERROR_SERVER_DIED

67 to use for displaying the video portion of the media.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

69

Set a DRM engine plugin String property value.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

71

Sets the player to be looping or non-looping.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

73

Set the MediaPlayer to start when this MediaPlayer finishes playback (i.e.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

75

Register a callback to be invoked when the status of a network stream's buffer has changed.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

77

Register a callback to be invoked when the end of a media source has been reached during playback.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

79

Register a callback to be invoked for configuration of the DRM object before the session is created.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

81

Register a callback to be invoked when the DRM info is known.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

83

Register a callback to be invoked when the DRM info is known.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

85

Register a callback to be invoked when the DRM object is prepared.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

87

Register a callback to be invoked when the DRM object is prepared.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

89

Register a callback to be invoked when an error has happened during an asynchronous operation.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

91

Register a callback to be invoked when an info/warning is available.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

93

Sets the listener to be invoked when a media time discontinuity is encountered.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

95

Sets the listener to be invoked when a media time discontinuity is encountered.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

97

Register a callback to be invoked when the media source is ready for playback.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_SERVER_DIED

99

Register a callback to be invoked when a seek operation has been completed.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

01

Sets the listener to be invoked when a subtitle track has new data available.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

03

Sets the listener to be invoked when a subtitle track has new data available.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

05

Register a callback to be invoked when a selected track has timed metadata available.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

07

Register a callback to be invoked when a timed text is available for display.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

09

Register a callback to be invoked when the video size is known or updated.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

11

Sets playback rate using

public static final int MEDIA_ERROR_TIMED_OUT

12.

public static final int MEDIA_ERROR_SERVER_DIED

08

public static final int MEDIA_ERROR_TIMED_OUT

14

Specifies an audio device (via an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 object) to route the output from this MediaPlayer.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

17

Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

19

Sets the

public static final int MEDIA_ERROR_TIMED_OUT

20 to be used as the sink for the video portion of the media.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

22

Sets A/V sync mode.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

24

Sets video scaling mode.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

26

Sets the volume on this player.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

28

Set the low-level power management behavior for this MediaPlayer.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

30

Starts or resumes playback.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

32

Stops playback after playback has been started or paused.

Protected methods

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

34

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

Inherited methods

From class

public static final int MEDIA_ERROR_TIMED_OUT

35

public static final int MEDIA_ERROR_TIMED_OUT

36

public static final int MEDIA_ERROR_TIMED_OUT

37

Creates and returns a copy of this object.

public static final int MEDIA_ERROR_SERVER_DIED

08

public static final int MEDIA_ERROR_TIMED_OUT

39

Indicates whether some other object is "equal to" this one.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

32

public static final int MEDIA_ERROR_TIMED_OUT

41

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

public static final int MEDIA_ERROR_TIMED_OUT

42

public static final int MEDIA_ERROR_TIMED_OUT

43

Returns the runtime class of this

public static final int MEDIA_ERROR_TIMED_OUT

44.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

70

public static final int MEDIA_ERROR_TIMED_OUT

46

Returns a hash code value for the object.

public static final int MEDIA_ERROR_TIMED_OUT

47

public static final int MEDIA_ERROR_TIMED_OUT

48

Wakes up a single thread that is waiting on this object's monitor.

public static final int MEDIA_ERROR_TIMED_OUT

47

public static final int MEDIA_ERROR_TIMED_OUT

50

Wakes up all threads that are waiting on this object's monitor.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

76

public static final int MEDIA_ERROR_TIMED_OUT

52

Returns a string representation of the object.

public static final int MEDIA_ERROR_TIMED_OUT

47

public static final int MEDIA_ERROR_TIMED_OUT

54

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

public static final int MEDIA_ERROR_TIMED_OUT

47

public static final int MEDIA_ERROR_TIMED_OUT

56

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

public static final int MEDIA_ERROR_TIMED_OUT

47

public static final int MEDIA_ERROR_TIMED_OUT

58

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

From interface

public static final int MEDIA_ERROR_TIMED_OUT

59

public static final int MEDIA_ERROR_TIMED_OUT

60

public static final int MEDIA_ERROR_TIMED_OUT

61

Returns a

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

67 object that can be used modify the volume envelope of the player or track.

From interface

public static final int MEDIA_ERROR_TIMED_OUT

63

public static final int MEDIA_ERROR_TIMED_OUT

64

public static final int MEDIA_ERROR_TIMED_OUT

65

Adds an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

34 to receive notifications of routing changes on this AudioTrack/AudioRecord.

public static final int MEDIA_ERROR_TIMED_OUT

67

public static final int MEDIA_ERROR_TIMED_OUT

68

Returns the selected output/input specified by

public static final int MEDIA_ERROR_TIMED_OUT

69.

public static final int MEDIA_ERROR_TIMED_OUT

67

public static final int MEDIA_ERROR_TIMED_OUT

71

Returns an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 identifying the current routing of this AudioTrack/AudioRecord.

public static final int MEDIA_ERROR_TIMED_OUT

64

public static final int MEDIA_ERROR_TIMED_OUT

74

Removes an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

34 which has been previously added to receive rerouting notifications.

public static final int MEDIA_ERROR_TIMED_OUT

76

public static final int MEDIA_ERROR_TIMED_OUT

77

Specifies an audio device (via an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 object) to route the output/input to/from.

Constants

MEDIA_ERROR_IO

public static final int MEDIA_ERROR_IO

File or network related operation errors.

Constant Value: -1004 (0xfffffc14)

MEDIA_ERROR_MALFORMED

public static final int MEDIA_ERROR_MALFORMED

Bitstream is not conforming to the related coding standard or file spec.

Constant Value: -1007 (0xfffffc11)

MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

public static final 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.

Constant Value: 200 (0x000000c8)

MEDIA_ERROR_SERVER_DIED

public static final int MEDIA_ERROR_SERVER_DIED

Media server died. In this case, the application must release the MediaPlayer object and instantiate a new one.

Constant Value: 100 (0x00000064)

MEDIA_ERROR_TIMED_OUT

public static final int MEDIA_ERROR_TIMED_OUT

Some operation takes too long to complete, usually more than 3-5 seconds.

Constant Value: -110 (0xffffff92)

MEDIA_ERROR_UNKNOWN

public static final int MEDIA_ERROR_UNKNOWN

Unspecified media player error.

Constant Value: 1 (0x00000001)

MEDIA_ERROR_UNSUPPORTED

public static final int MEDIA_ERROR_UNSUPPORTED

Bitstream is conforming to the related coding standard or file spec, but the media framework does not support the feature.

Constant Value: -1010 (0xfffffc0e)

MEDIA_INFO_AUDIO_NOT_PLAYING

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

Informs that audio is not playing. Note that playback of the video is not interrupted.

Constant Value: 804 (0x00000324)

MEDIA_INFO_BAD_INTERLEAVING

public static final 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. Video is playing but a lot of disk seeks may be happening.

Constant Value: 800 (0x00000320)

MEDIA_INFO_BUFFERING_END

public static final int MEDIA_INFO_BUFFERING_END

MediaPlayer is resuming playback after filling buffers.

Constant Value: 702 (0x000002be)

MEDIA_INFO_BUFFERING_START

public static final int MEDIA_ERROR_MALFORMED

0

MediaPlayer is temporarily pausing playback internally in order to buffer more data.

Constant Value: 701 (0x000002bd)

MEDIA_INFO_METADATA_UPDATE

public static final int MEDIA_ERROR_MALFORMED

1

A new set of metadata is available.

Constant Value: 802 (0x00000322)

MEDIA_INFO_NOT_SEEKABLE

public static final int MEDIA_ERROR_MALFORMED

2

The media cannot be seeked (e.g live stream)

Constant Value: 801 (0x00000321)

MEDIA_INFO_STARTED_AS_NEXT

public static final int MEDIA_ERROR_MALFORMED

3

The player was started because it was used as the next player for another player, which just completed playback.

Constant Value: 2 (0x00000002)

MEDIA_INFO_SUBTITLE_TIMED_OUT

public static final int MEDIA_ERROR_MALFORMED

4

Reading the subtitle track takes too long.

Constant Value: 902 (0x00000386)

MEDIA_INFO_UNKNOWN

public static final int MEDIA_ERROR_MALFORMED

5

Unspecified media player info.

Constant Value: 1 (0x00000001)

MEDIA_INFO_UNSUPPORTED_SUBTITLE

public static final int MEDIA_ERROR_MALFORMED

6

Subtitle track was not supported by the media framework.

Constant Value: 901 (0x00000385)

MEDIA_INFO_VIDEO_NOT_PLAYING

public static final int MEDIA_ERROR_MALFORMED

7

Informs that video is not playing. Note that playback of the audio is not interrupted.

Constant Value: 805 (0x00000325)

MEDIA_INFO_VIDEO_RENDERING_START

public static final int MEDIA_ERROR_MALFORMED

8

The player just pushed the very first video frame for rendering.

Constant Value: 3 (0x00000003)

MEDIA_INFO_VIDEO_TRACK_LAGGING

public static final int MEDIA_ERROR_MALFORMED

9

The video is too complex for the decoder: it can't decode frames fast enough. Possibly only the audio plays fine at this stage.

Constant Value: 700 (0x000002bc)

MEDIA_MIMETYPE_TEXT_SUBRIP

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

0

This constant was deprecated in API level 28. use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

04

MIME type for SubRip (SRT) container. Used in addTimedTextSource APIs.

Constant Value: "application/x-subrip"

PREPARE_DRM_STATUS_PREPARATION_ERROR

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

1

The DRM preparation has failed .

Constant Value: 3 (0x00000003)

PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

2

The device required DRM provisioning but couldn't reach the provisioning server.

Constant Value: 1 (0x00000001)

PREPARE_DRM_STATUS_PROVISIONING_SERVER_ERROR

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

3

The device required DRM provisioning but the provisioning server denied the request.

Constant Value: 2 (0x00000002)

PREPARE_DRM_STATUS_SUCCESS

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

4

The status codes for

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

13 listener.

DRM preparation has succeeded.

Constant Value: 0 (0x00000000)

SEEK_CLOSEST

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

5

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a frame (not necessarily a key frame) associated with a data source that is located closest to or at the given time.

Constant Value: 3 (0x00000003)

SEEK_CLOSEST_SYNC

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

6

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located closest to (in time) or at the given time.

Constant Value: 2 (0x00000002)

SEEK_NEXT_SYNC

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

7

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located right after or at the given time.

Constant Value: 1 (0x00000001)

SEEK_PREVIOUS_SYNC

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

8

This mode is used with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 to move media position to a sync (or key) frame associated with a data source that is located right before or at the given time.

Constant Value: 0 (0x00000000)

VIDEO_SCALING_MODE_SCALE_TO_FIT

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

9

Specifies a video scaling mode. The content is stretched to the surface rendering area. When the surface has the same aspect ratio as the content, the aspect ratio of the content is maintained; otherwise, the aspect ratio of the content is not maintained when video is being rendered. Unlike

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

29, there is no content cropping with this video scaling mode.

Constant Value: 1 (0x00000001)

VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING

public static final int MEDIA_ERROR_SERVER_DIED

0

Specifies a video scaling mode. The content is scaled, maintaining its aspect ratio. The whole surface area is always used. When the aspect ratio of the content is the same as the surface, no content is cropped; otherwise, content is cropped to fit the surface.

Constant Value: 2 (0x00000002)

Public constructors

MediaPlayer

public static final int MEDIA_ERROR_SERVER_DIED

1

Default constructor.

Consider using one of the create() methods for synchronously instantiating a MediaPlayer from a Uri or resource.

You must call

public static final int MEDIA_ERROR_MALFORMED

12 when you are finished using the instantiated instance. Doing so frees any resources you have previously acquired.

MediaPlayer

public static final int MEDIA_ERROR_SERVER_DIED

2

Default constructor with context.

Consider using one of the create() methods for synchronously instantiating a MediaPlayer from a Uri or resource.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: non-null context. This context will be used to pull information, such as

public static final int MEDIA_ERROR_TIMED_OUT

89 and device specific session ids, which will be associated with the

public static final int MEDIA_ERROR_TIMED_OUT

90. However, the context itself will not be retained by the MediaPlayer.

Public methods

addTimedTextSource

public static final int MEDIA_ERROR_SERVER_DIED

3

Adds an external timed text source file (FileDescriptor). It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns. Currently supported format is SubRip. Note that a single external timed text source may contain multiple tracks in it. One can find the total number of available tracks using

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to see what additional tracks become available after this method call.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

92

public static final int MEDIA_ERROR_TIMED_OUT

93: the FileDescriptor for the file you want to play

public static final int MEDIA_ERROR_TIMED_OUT

94

public static final int MEDIA_ERROR_TIMED_OUT

95: The mime type of the file. Must be one of the mime types listed above. Throws

public static final int MEDIA_ERROR_TIMED_OUT

96 if the mimeType is not supported.

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

addTimedTextSource

public static final int MEDIA_ERROR_SERVER_DIED

4

Adds an external timed text source file. Currently supported format is SubRip with the file extension .srt, case insensitive. Note that a single external timed text source may contain multiple tracks in it. One can find the total number of available tracks using

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to see what additional tracks become available after this method call.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

99

public static final int MEDIA_ERROR_TIMED_OUT

95: The file path of external timed text source file.

public static final int MEDIA_ERROR_TIMED_OUT

94

public static final int MEDIA_ERROR_TIMED_OUT

95: The mime type of the file. Must be one of the mime types listed above. Throws

public static final int MEDIA_ERROR_UNKNOWN

03 if the file cannot be accessed or is corrupted.

public static final int MEDIA_ERROR_TIMED_OUT

96 if the mimeType is not supported.

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

addTimedTextSource

public static final int MEDIA_ERROR_SERVER_DIED

5

Adds an external timed text file (FileDescriptor). It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns. Currently supported format is SubRip. Note that a single external timed text source may contain multiple tracks in it. One can find the total number of available tracks using

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to see what additional tracks become available after this method call.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

92

public static final int MEDIA_ERROR_TIMED_OUT

93: the FileDescriptor for the file you want to play

public static final int MEDIA_ERROR_UNKNOWN

09

public static final int MEDIA_ERROR_UNKNOWN

10: the offset into the file where the data to be played starts, in bytes

public static final int MEDIA_ERROR_UNKNOWN

11

public static final int MEDIA_ERROR_UNKNOWN

10: the length in bytes of the data to be played

public static final int MEDIA_ERROR_UNKNOWN

13

public static final int MEDIA_ERROR_TIMED_OUT

95: The mime type of the file. Must be one of the mime types listed above. Throws

public static final int MEDIA_ERROR_TIMED_OUT

96 if the mimeType is not supported.

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

addTimedTextSource

public static final int MEDIA_ERROR_SERVER_DIED

6

Adds an external timed text source file (Uri). Currently supported format is SubRip with the file extension .srt, case insensitive. Note that a single external timed text source may contain multiple tracks in it. One can find the total number of available tracks using

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to see what additional tracks become available after this method call.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use when resolving the Uri

public static final int MEDIA_ERROR_UNKNOWN

20

public static final int MEDIA_ERROR_UNKNOWN

21: the Content URI of the data you want to play

public static final int MEDIA_ERROR_TIMED_OUT

94

public static final int MEDIA_ERROR_TIMED_OUT

95: The mime type of the file. Must be one of the mime types listed above. Throws

public static final int MEDIA_ERROR_UNKNOWN

03 if the file cannot be accessed or is corrupted.

public static final int MEDIA_ERROR_TIMED_OUT

96 if the mimeType is not supported.

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

attachAuxEffect

public static final int MEDIA_ERROR_SERVER_DIED

7

Attaches an auxiliary effect to the player. A typical auxiliary effect is a reverberation effect which can be applied on any sound source that directs a certain amount of its energy to this effect. This amount is defined by setAuxEffectSendLevel(). See

public static final int MEDIA_ERROR_UNKNOWN

27.

After creating an auxiliary effect (e.g.

public static final int MEDIA_ERROR_UNKNOWN

28), retrieve its ID with

public static final int MEDIA_ERROR_UNKNOWN

29 and use it when calling this method to attach the player to the effect.

To detach the effect from the player, call this method with a null effect id.

This method must be called after one of the overloaded

public static final int MEDIA_ERROR_UNKNOWN

30 methods.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

31

public static final int MEDIA_ERROR_MALFORMED

62: system wide unique id of the effect to attach

create

public static final int MEDIA_ERROR_SERVER_DIED

8

Same factory method as

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

58 but that lets you specify the audio attributes and session ID to be used by the new MediaPlayer instance.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use

public static final int MEDIA_ERROR_UNKNOWN

36

public static final int MEDIA_ERROR_MALFORMED

62: the raw resource id (R.raw.) for the resource to use as the datasource

public static final int MEDIA_ERROR_UNKNOWN

38

public static final int MEDIA_ERROR_UNKNOWN

39: the

public static final int MEDIA_ERROR_UNKNOWN

40 to be used by the media player.

public static final int MEDIA_ERROR_UNKNOWN

41

public static final int MEDIA_ERROR_MALFORMED

62: the audio session ID to be used by the media player, see

public static final int MEDIA_ERROR_UNKNOWN

43 to obtain a new session. Returns

public static final int MEDIA_ERROR_TIMED_OUT

90 a MediaPlayer object, or null if creation failed

create

public static final int MEDIA_ERROR_SERVER_DIED

9

Convenience method to create a MediaPlayer for a given Uri. On success,

public static final int MEDIA_ERROR_UNKNOWN

45 will already have been called and must not be called again.

You must call

public static final int MEDIA_ERROR_MALFORMED

12 when you are finished using the created instance. Doing so frees any resources you have previously acquired.

Note that since

public static final int MEDIA_ERROR_UNKNOWN

45 is called automatically in this method, you cannot change the audio session ID (see

public static final int MEDIA_ERROR_UNKNOWN

  1. or audio attributes (see

public static final int MEDIA_ERROR_SERVER_DIED

46 of the new MediaPlayer.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use

public static final int MEDIA_ERROR_UNKNOWN

20

public static final int MEDIA_ERROR_UNKNOWN

21: the Uri from which to get the datasource

public static final int MEDIA_ERROR_UNKNOWN

54

public static final int MEDIA_ERROR_UNKNOWN

55: the SurfaceHolder to use for displaying the video Returns

public static final int MEDIA_ERROR_TIMED_OUT

90 a MediaPlayer object, or null if creation failed

create

public static final int MEDIA_ERROR_TIMED_OUT

0

Convenience method to create a MediaPlayer for a given resource id. On success,

public static final int MEDIA_ERROR_UNKNOWN

45 will already have been called and must not be called again.

You must call

public static final int MEDIA_ERROR_MALFORMED

12 when you are finished using the created instance. Doing so frees any resources you have previously acquired.

Note that since

public static final int MEDIA_ERROR_UNKNOWN

45 is called automatically in this method, you cannot change the audio session ID (see

public static final int MEDIA_ERROR_UNKNOWN

  1. or audio attributes (see

public static final int MEDIA_ERROR_SERVER_DIED

46 of the new MediaPlayer.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use

public static final int MEDIA_ERROR_UNKNOWN

36

public static final int MEDIA_ERROR_MALFORMED

62: the raw resource id (R.raw.) for the resource to use as the datasource Returns

public static final int MEDIA_ERROR_TIMED_OUT

90 a MediaPlayer object, or null if creation failed

create

public static final int MEDIA_ERROR_TIMED_OUT

1

Convenience method to create a MediaPlayer for a given Uri. On success,

public static final int MEDIA_ERROR_UNKNOWN

45 will already have been called and must not be called again.

You must call

public static final int MEDIA_ERROR_MALFORMED

12 when you are finished using the created instance. Doing so frees any resources you have previously acquired.

Note that since

public static final int MEDIA_ERROR_UNKNOWN

45 is called automatically in this method, you cannot change the audio session ID (see

public static final int MEDIA_ERROR_UNKNOWN

  1. or audio attributes (see

public static final int MEDIA_ERROR_SERVER_DIED

46 of the new MediaPlayer.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use

public static final int MEDIA_ERROR_UNKNOWN

20

public static final int MEDIA_ERROR_UNKNOWN

21: the Uri from which to get the datasource Returns

public static final int MEDIA_ERROR_TIMED_OUT

90 a MediaPlayer object, or null if creation failed

createVolumeShaper

public static final int MEDIA_ERROR_TIMED_OUT

2

Returns a

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

67 object that can be used modify the volume envelope of the player or track.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

78

public static final int MEDIA_ERROR_UNKNOWN

79: This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Returns

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

67 This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

deselectTrack

public static final int MEDIA_ERROR_TIMED_OUT

3

Deselect a track.

Currently, the track must be a timed text track and no audio or video tracks can be deselected. If the timed text track identified by index has not been selected before, it throws an exception.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

83

public static final int MEDIA_ERROR_MALFORMED

62: the index of the track to be deselected. The valid range of the index is 0..total number of tracks - 1. The total number of tracks as well as the type of each individual track can be found by calling

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 method. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

getAudioSessionId

public static final int MEDIA_ERROR_TIMED_OUT

4

Returns the audio session ID.

Returns

public static final int MEDIA_ERROR_MALFORMED

62 the audio session ID. Note that the audio session ID is 0 only if a problem occured when the MediaPlayer was contructed.

getCurrentPosition

public static final int MEDIA_ERROR_TIMED_OUT

5

Gets the current playback position.

Returns

public static final int MEDIA_ERROR_MALFORMED

62 the current position in milliseconds

getDuration

public static final int MEDIA_ERROR_TIMED_OUT

6

Gets the duration of the file.

Returns

public static final int MEDIA_ERROR_MALFORMED

62 the duration in milliseconds, if no duration is available (for example, if streaming live content), -1 is returned.

getKeyRequest

public static final int MEDIA_ERROR_TIMED_OUT

7

A key request/response exchange occurs between the app and a license server to obtain or release keys used to decrypt encrypted content.

getKeyRequest() is used to obtain an opaque key request byte array that is delivered to the license server. The opaque key request byte array is returned in KeyRequest.data. The recommended URL to deliver the key request to is returned in KeyRequest.defaultUrl.

After the app has received the key request response from the server, it should deliver to the response to the DRM engine plugin using the method

public static final int MEDIA_ERROR_UNKNOWN

90.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

91

public static final int MEDIA_ERROR_UNKNOWN

92: is the key-set identifier of the offline keys being released when keyType is

public static final int MEDIA_ERROR_UNKNOWN

93. It should be set to null for other key requests, when keyType is

public static final int MEDIA_ERROR_UNKNOWN

94 or

public static final int MEDIA_ERROR_UNKNOWN

95.

public static final int MEDIA_ERROR_UNKNOWN

96

public static final int MEDIA_ERROR_UNKNOWN

92: is the container-specific initialization data when the keyType is

public static final int MEDIA_ERROR_UNKNOWN

94 or

public static final int MEDIA_ERROR_UNKNOWN

95. Its meaning is interpreted based on the mime type provided in the mimeType parameter. It could contain, for example, the content ID, key ID or other data obtained from the content metadata that is required in generating the key request. When the keyType is

public static final int MEDIA_ERROR_UNKNOWN

93, it should be set to null.

public static final int MEDIA_ERROR_TIMED_OUT

94

public static final int MEDIA_ERROR_TIMED_OUT

95: identifies the mime type of the content This value may be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_ERROR_UNSUPPORTED

04

public static final int MEDIA_ERROR_MALFORMED

62: specifies the type of the request. The request may be to acquire keys for streaming,

public static final int MEDIA_ERROR_UNKNOWN

94, or for offline content

public static final int MEDIA_ERROR_UNKNOWN

95, or to release previously acquired keys (

public static final int MEDIA_ERROR_UNKNOWN

93), which are identified by a keySetId. Value is

public static final int MEDIA_ERROR_UNSUPPORTED

09,

public static final int MEDIA_ERROR_UNSUPPORTED

10, or

public static final int MEDIA_ERROR_UNSUPPORTED

11

public static final int MEDIA_ERROR_UNSUPPORTED

12

public static final int MEDIA_ERROR_UNSUPPORTED

13: are included in the key request message to allow a client application to provide additional message parameters to the server. This may be

public static final int MEDIA_ERROR_UNKNOWN

80 if no additional parameters are to be sent. Returns

public static final int MEDIA_ERROR_UNSUPPORTED

15 This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_MALFORMED

27 if there is no active DRM session

getMetrics

public static final int MEDIA_ERROR_TIMED_OUT

8

Return Metrics data about the current player.

Returns

public static final int MEDIA_ERROR_UNSUPPORTED

18 a

public static final int MEDIA_ERROR_UNSUPPORTED

18 containing the set of attributes and values available for the media being handled by this instance of MediaPlayer The attributes are descibed in

public static final int MEDIA_ERROR_UNSUPPORTED

20. Additional vendor-specific fields may also be present in the return value.

getPlaybackParams

public static final int MEDIA_ERROR_TIMED_OUT

9

Gets the playback params, containing the current playback rate.

Returns

public static final int MEDIA_ERROR_TIMED_OUT

12 the playback params. This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized.

getRoutedDevice

public static final int MEDIA_ERROR_UNKNOWN

0

Returns an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 identifying the current routing of this MediaPlayer Note: The query is only valid if the MediaPlayer is currently playing. If the player is not playing, the returned device can be null or correspond to previously selected device when the player was last active.

Returns

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91

getSelectedTrack

public static final int MEDIA_ERROR_UNKNOWN

1

Returns the index of the audio, video, or subtitle track currently selected for playback, The return value is an index into the array returned by

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94, and can be used in calls to

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

95 or

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

96.

Parameters

public static final int MEDIA_ERROR_UNSUPPORTED

29

public static final int MEDIA_ERROR_MALFORMED

62: should be one of

public static final int MEDIA_ERROR_UNSUPPORTED

31,

public static final int MEDIA_ERROR_UNSUPPORTED

32, or

public static final int MEDIA_ERROR_UNSUPPORTED

33 Returns

public static final int MEDIA_ERROR_MALFORMED

62 index of the audio, video, or subtitle track currently selected for playback; a negative integer is returned when there is no selected track for

public static final int MEDIA_ERROR_UNSUPPORTED

29 or when

public static final int MEDIA_ERROR_UNSUPPORTED

29 is not one of audio, video, or subtitle. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if called after

public static final int MEDIA_ERROR_MALFORMED

12

getSyncParams

public static final int MEDIA_ERROR_UNKNOWN

2

Gets the A/V sync mode.

Returns

public static final int MEDIA_ERROR_UNSUPPORTED

39 the A/V sync params This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized.

getTimestamp

public static final int MEDIA_ERROR_UNKNOWN

3

Get current playback position as a

public static final int MEDIA_ERROR_SERVER_DIED

01.

The MediaTimestamp represents how the media time correlates to the system time in a linear fashion using an anchor and a clock rate. During regular playback, the media time moves fairly constantly (though the anchor frame may be rebased to a current system time, the linear correlation stays steady). Therefore, this method does not need to be called often.

To help users get current playback position, this method always anchors the timestamp to the current

public static final int MEDIA_ERROR_UNSUPPORTED

43, so

public static final int MEDIA_ERROR_UNSUPPORTED

44 can be used as current playback position.

Returns

public static final int MEDIA_ERROR_SERVER_DIED

01 a MediaTimestamp object if a timestamp is available, or

public static final int MEDIA_ERROR_UNKNOWN

80 if no timestamp is available, e.g. because the media player has not been initialized.

getTrackInfo

public static final int MEDIA_ERROR_UNKNOWN

4

Returns an array of track information.

Returns

public static final int MEDIA_ERROR_UNSUPPORTED

47 Array of track info. The total number of tracks is the array length. Must be called again if an external timed text source has been added after any of the addTimedTextSource methods are called. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state.

isLooping

public static final int MEDIA_ERROR_UNKNOWN

5

Checks whether the MediaPlayer is looping or non-looping.

Returns

public static final int MEDIA_ERROR_UNSUPPORTED

49 true if the MediaPlayer is currently looping, false otherwise

isPlaying

public static final int MEDIA_ERROR_UNKNOWN

6

Checks whether the MediaPlayer is playing.

Returns

public static final int MEDIA_ERROR_UNSUPPORTED

49 true if currently playing, false otherwise Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized or has been released.

pause

public static final int MEDIA_ERROR_UNKNOWN

7

Pauses playback. Call start() to resume.

Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized.

prepare

public static final int MEDIA_ERROR_UNKNOWN

8

Prepares the player for playback, synchronously. After setting the datasource and the display surface, you need to either call prepare() or prepareAsync(). For files, it is OK to call prepare(), which blocks until MediaPlayer is ready for playback.

Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_UNKNOWN

03

prepareAsync

public static final int MEDIA_ERROR_UNKNOWN

9

Prepares the player for playback, asynchronously. After setting the datasource and the display surface, you need to either call prepare() or prepareAsync(). For streams, you should call prepareAsync(), which returns immediately, rather than blocking until enough data has been buffered.

Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

prepareDrm

public static final int MEDIA_ERROR_UNSUPPORTED

0

Prepares the DRM for the current source

If

public static final int MEDIA_ERROR_SERVER_DIED

20 is registered, it will be called during preparation to allow configuration of the DRM properties before opening the DRM session. Note that the callback is called synchronously in the thread that called

public static final int MEDIA_ERROR_UNSUPPORTED

57. It should be used only for a series of

public static final int MEDIA_ERROR_UNSUPPORTED

58 and

public static final int MEDIA_ERROR_UNSUPPORTED

59 calls and refrain from any lengthy operation.

If the device has not been provisioned before, this call also provisions the device which involves accessing the provisioning server and can take a variable time to complete depending on the network connectivity. If

public static final int MEDIA_ERROR_UNSUPPORTED

60 is registered, prepareDrm() runs in non-blocking mode by launching the provisioning in the background and returning. The listener will be called when provisioning and preparation has finished. If a

public static final int MEDIA_ERROR_UNSUPPORTED

60 is not registered, prepareDrm() waits till provisioning and preparation has finished, i.e., runs in blocking mode.

If

public static final int MEDIA_ERROR_UNSUPPORTED

60 is registered, it is called to indicate the DRM session being ready. The application should not make any assumption about its call sequence (e.g., before or after prepareDrm returns), or the thread context that will execute the listener (unless the listener is registered with a handler thread).

Parameters

public static final int MEDIA_ERROR_UNSUPPORTED

63

public static final int MEDIA_ERROR_UNSUPPORTED

64: The UUID of the crypto scheme. If not known beforehand, it can be retrieved from the source through

public static final int MEDIA_ERROR_UNSUPPORTED

65 or registering a

public static final int MEDIA_ERROR_UNSUPPORTED

66. This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if called before prepare(), or the DRM was prepared already

public static final int MEDIA_ERROR_UNSUPPORTED

69 if the crypto scheme is not supported

public static final int MEDIA_ERROR_UNSUPPORTED

70 if required DRM resources are in use

public static final int MEDIA_ERROR_MALFORMED

57 if provisioning is required but failed due to a network error

public static final int MEDIA_ERROR_MALFORMED

59 if provisioning is required but failed due to the request denied by the provisioning server

provideKeyResponse

public static final int MEDIA_ERROR_UNSUPPORTED

1

A key response is received from the license server by the app, then it is provided to the DRM engine plugin using provideKeyResponse. When the response is for an offline key request, a key-set identifier is returned that can be used to later restore the keys to a new session with the method {@ link # restoreKeys}. When the response is for a streaming or release request, null is returned.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

91

public static final int MEDIA_ERROR_UNKNOWN

92: When the response is for a release request, keySetId identifies the saved key associated with the release request (i.e., the same keySetId passed to the earlier {@ link # getKeyRequest} call. It MUST be null when the response is for either streaming or offline key requests.

public static final int MEDIA_ERROR_UNSUPPORTED

75

public static final int MEDIA_ERROR_UNKNOWN

92: the byte array response from the server Returns

public static final int MEDIA_ERROR_UNSUPPORTED

77 Throws

public static final int MEDIA_ERROR_MALFORMED

27 if there is no active DRM session

public static final int MEDIA_ERROR_UNSUPPORTED

79 if the response indicates that the server rejected the request

release

public static final int MEDIA_ERROR_UNSUPPORTED

2

Releases resources associated with this MediaPlayer object.

You must call this method once the instance is no longer required.

releaseDrm

public static final int MEDIA_ERROR_UNSUPPORTED

3

Releases the DRM session

The player has to have an active DRM session and be in stopped, or prepared state before this call is made. A

public static final int MEDIA_ERROR_UNSUPPORTED

80 call will release the DRM session implicitly.

Throws

public static final int MEDIA_ERROR_MALFORMED

27 if there is no active DRM session to release

reset

public static final int MEDIA_ERROR_UNSUPPORTED

4

Resets the MediaPlayer to its uninitialized state. After calling this method, you will have to initialize it again by setting the data source and calling prepare().

restoreKeys

public static final int MEDIA_ERROR_UNSUPPORTED

5

Restore persisted offline keys into a new session. keySetId identifies the keys to load, obtained from a prior call to

public static final int MEDIA_ERROR_UNKNOWN

90.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

91

public static final int MEDIA_ERROR_UNKNOWN

92: identifies the saved key set to restore This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_MALFORMED

27

seekTo

public static final int MEDIA_ERROR_UNSUPPORTED

6

Seeks to specified time position. Same as

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

16 with

public static final int MEDIA_ERROR_UNSUPPORTED

88.

Parameters

public static final int MEDIA_ERROR_UNSUPPORTED

89

public static final int MEDIA_ERROR_MALFORMED

62: the offset in milliseconds from the start to seek to Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized

seekTo

public static final int MEDIA_ERROR_UNSUPPORTED

7

Moves the media to specified time position by considering the given mode.

When seekTo is finished, the user will be notified via OnSeekComplete supplied by the user. There is at most one active seekTo processed at any time. If there is a to-be-completed seekTo, new seekTo requests will be queued in such a way that only the last request is kept. When current seekTo is completed, the queued request will be processed if that request is different from just-finished seekTo operation, i.e., the requested position or mode is different.

Parameters

public static final int MEDIA_ERROR_UNSUPPORTED

89

public static final int MEDIA_ERROR_UNKNOWN

10: the offset in milliseconds from the start to seek to. When seeking to the given time position, there is no guarantee that the data source has a frame located at the position. When this happens, a frame nearby will be rendered. If msec is negative, time position zero will be used. If msec is larger than duration, duration will be used.

public static final int MEDIA_ERROR_UNSUPPORTED

94

public static final int MEDIA_ERROR_MALFORMED

62: the mode indicating where exactly to seek to. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

24 if one wants to seek to a sync frame that has a timestamp earlier than or the same as msec. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

21 if one wants to seek to a sync frame that has a timestamp later than or the same as msec. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

18 if one wants to seek to a sync frame that has a timestamp closest to or the same as msec. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

15 if one wants to seek to a frame that may or may not be a sync frame but is closest to or the same as msec.

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

15 often has larger performance overhead compared to the other options if there is no sync frame located at msec. Value is

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

24,

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

21,

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

18, or

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

15 Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized

public static final int MEDIA_ERROR_TIMED_OUT

96 if the mode is invalid.

selectTrack

public static final int MEDIA_ERROR_UNSUPPORTED

8

Selects a track.

If a MediaPlayer is in invalid state, it throws an IllegalStateException exception. If a MediaPlayer is in Started state, the selected track is presented immediately. If a MediaPlayer is not in Started state, it just marks the track to be played.

In any valid state, if it is called multiple times on the same type of track (ie. Video, Audio, Timed Text), the most recent one will be chosen.

The first audio and video tracks are selected by default if available, even though this method is not called. However, no timed text track will be selected until this function is called.

Currently, only timed text, subtitle or audio tracks can be selected via this method. In addition, the support for selecting an audio track at runtime is pretty limited in that an audio track can only be selected in the Prepared state.

Parameters

public static final int MEDIA_ERROR_UNKNOWN

83

public static final int MEDIA_ERROR_MALFORMED

62: the index of the track to be selected. The valid range of the index is 0..total number of track - 1. The total number of tracks as well as the type of each individual track can be found by calling

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 method. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if called in an invalid state.

setAudioAttributes

public static final int MEDIA_ERROR_UNSUPPORTED

9

Sets the audio attributes for this MediaPlayer. See

public static final int MEDIA_ERROR_UNKNOWN

40 for how to build and configure an instance of this class. You must call this method before

public static final int MEDIA_ERROR_UNKNOWN

45 or

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

13 in order for the audio attributes to become effective thereafter.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

14

public static final int MEDIA_ERROR_UNKNOWN

39: a non-null set of audio attributes Throws

public static final int MEDIA_ERROR_TIMED_OUT

96

setAudioSessionId

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

0

Sets the audio session ID.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

17

public static final int MEDIA_ERROR_MALFORMED

62: the audio session ID. The audio session ID is a system wide unique identifier for the audio stream played by this MediaPlayer instance. The primary use of the audio session ID is to associate audio effects to a particular instance of MediaPlayer: if an audio session ID is provided when creating an audio effect, this effect will be applied only to the audio content of media players within the same audio session and not to the output mix. When created, a MediaPlayer instance automatically generates its own audio session ID. However, it is possible to force this player to be part of an already existing audio session by calling this method. This method must be called before one of the overloaded

public static final int MEDIA_ERROR_UNKNOWN

30 methods. Note that session id set using this method will override device-specific audio session id, if the

public static final int MEDIA_ERROR_TIMED_OUT

90 was instantiated using device-specific

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

21 - see

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

22. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_TIMED_OUT

96

setAudioStreamType

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

1

This method was deprecated in API level 26. use

public static final int MEDIA_ERROR_SERVER_DIED

46

Sets the audio stream type for this MediaPlayer. See

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

26 for a list of stream types. Must call this method before prepare() or prepareAsync() in order for the target stream type to become effective thereafter.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

27

public static final int MEDIA_ERROR_MALFORMED

62: the audio stream type

setAuxEffectSendLevel

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

2

Sets the send level of the player to the attached auxiliary effect. See

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

29. The level value range is 0 to 1.0.

By default the send level is 0, so even if an effect is attached to the player this method must be called for the effect to be applied.

Note that the passed level value is a raw scalar. UI controls should be scaled logarithmically: the gain applied by audio framework ranges from -72dB to 0dB, so an appropriate conversion from linear UI input x to level is: x == 0 -> level = 0 0 < x <= R -> level = 10^(72*(x-R)/20/R)

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

30

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

31: send level scalar

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

3

Sets the data source (AssetFileDescriptor) to use. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

32

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

33: the AssetFileDescriptor for the file you want to play This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_TIMED_OUT

96 if afd is not a valid AssetFileDescriptor

public static final int MEDIA_ERROR_UNKNOWN

03 if afd can not be read

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

4

Sets the data source (FileDescriptor) to use. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

92

public static final int MEDIA_ERROR_TIMED_OUT

93: the FileDescriptor for the file you want to play Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_TIMED_OUT

96 if fd is not a valid FileDescriptor

public static final int MEDIA_ERROR_UNKNOWN

03 if fd can not be read

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

5

Sets the data source (FileDescriptor) to use. The FileDescriptor must be seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

92

public static final int MEDIA_ERROR_TIMED_OUT

93: the FileDescriptor for the file you want to play

public static final int MEDIA_ERROR_UNKNOWN

09

public static final int MEDIA_ERROR_UNKNOWN

10: the offset into the file where the data to be played starts, in bytes

public static final int MEDIA_ERROR_UNKNOWN

11

public static final int MEDIA_ERROR_UNKNOWN

10: the length in bytes of the data to be played Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_TIMED_OUT

96 if fd is not a valid FileDescriptor

public static final int MEDIA_ERROR_UNKNOWN

03 if fd can not be read

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

6

Sets the data source (file-path or http/rtsp URL) to use.

When

public static final int MEDIA_ERROR_TIMED_OUT

99 refers to a local file, the file may actually be opened by a process other than the calling application. This implies that the pathname should be an absolute path (as any other process runs with unspecified current working directory), and that the pathname should reference a world-readable file. As an alternative, the application could first open the file for reading, and then use the file descriptor form

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

53.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

99

public static final int MEDIA_ERROR_TIMED_OUT

95: the path of the file, or the http/rtsp URL of the stream you want to play Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_UNKNOWN

03

public static final int MEDIA_ERROR_TIMED_OUT

96

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

59

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

7

Sets the data source (MediaDataSource) to use.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

60

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

61: the MediaDataSource for the media you want to play Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_TIMED_OUT

96 if dataSource is not a valid MediaDataSource

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

8

Sets the data source as a content Uri. To provide cookies for the subsequent HTTP requests, you can install your own default cookie handler and use other variants of setDataSource APIs instead. Alternatively, you can use this API to pass the cookies as a list of HttpCookie. If the app has not installed a CookieHandler already, this API creates a CookieManager and populates its CookieStore with the provided cookies. If the app has installed its own handler already, this API requires the handler to be of CookieManager type such that the API can update the manager\u2019s CookieStore.

Note that the cross domain redirection is allowed by default, but that can be changed with key/value pairs through the headers parameter with "android-allow-cross-domain-redirect" as the key and "0" or "1" as the value to disallow or allow cross domain redirection.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use when resolving the Uri This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_ERROR_UNKNOWN

20

public static final int MEDIA_ERROR_UNKNOWN

21: the Content URI of the data you want to play This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

70

public static final int MEDIA_ERROR_UNSUPPORTED

13: the headers to be sent together with the request for the data The headers must not include cookies. Instead, use the cookies param. This value may be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

73

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

74: the cookies to be sent together with the request This value may be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

96 if cookies are provided and the installed handler is not a CookieManager

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

78 if context or uri is null

public static final int MEDIA_ERROR_UNKNOWN

03 if uri has a file scheme and an I/O error occurs

setDataSource

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

9

Sets the data source as a content Uri.

Note that the cross domain redirection is allowed by default, but that can be changed with key/value pairs through the headers parameter with "android-allow-cross-domain-redirect" as the key and "0" or "1" as the value to disallow or allow cross domain redirection.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use when resolving the Uri This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_ERROR_UNKNOWN

20

public static final int MEDIA_ERROR_UNKNOWN

21: the Content URI of the data you want to play This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

70

public static final int MEDIA_ERROR_UNSUPPORTED

13: the headers to be sent together with the request for the data This value may be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

public static final int MEDIA_ERROR_UNKNOWN

03

public static final int MEDIA_ERROR_TIMED_OUT

96

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

59

setDisplay

public static final int MEDIA_INFO_BAD_INTERLEAVING

0

Sets the

public static final int MEDIA_ERROR_SERVER_DIED

67 to use for displaying the video portion of the media. Either a surface holder or surface must be set if a display or video sink is needed. Not calling this method or

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

94 when playing back a video will result in only the audio track being played. A null surface holder or surface will result in only the audio track being played.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

95

public static final int MEDIA_ERROR_UNKNOWN

55: the SurfaceHolder to use for video display Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized or has been released.

setLooping

public static final int MEDIA_INFO_BAD_INTERLEAVING

1

Sets the player to be looping or non-looping.

Parameters

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

98

public static final int MEDIA_ERROR_UNSUPPORTED

49: whether to loop or not

setNextMediaPlayer

public static final int MEDIA_INFO_BAD_INTERLEAVING

2

Set the MediaPlayer to start when this MediaPlayer finishes playback (i.e. reaches the end of the stream). The media framework will attempt to transition from this player to the next as seamlessly as possible. The next player can be set at any time before completion, but shall be after setDataSource has been called successfully. The next player must be prepared by the app, and the application should not call start() on it. The next MediaPlayer must be different from 'this'. An exception will be thrown if next == this. The application may call setNextMediaPlayer(null) to indicate no next player should be started at the end of playback. If the current player is looping, it will keep looping and the next player will not be started.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

00

public static final int MEDIA_INFO_BAD_INTERLEAVING

01: the player to start after this one completes playback.

setOnBufferingUpdateListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

3

Register a callback to be invoked when the status of a network stream's buffer has changed.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

03: the callback that will be run.

setOnCompletionListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

4

Register a callback to be invoked when the end of a media source has been reached during playback.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

05: the callback that will be run

setOnDrmConfigHelper

public static final int MEDIA_INFO_BAD_INTERLEAVING

5

Register a callback to be invoked for configuration of the DRM object before the session is created. The callback will be invoked synchronously during the execution of

public static final int MEDIA_INFO_BAD_INTERLEAVING

06.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

08: the callback that will be run

setOnDrmInfoListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

6

Register a callback to be invoked when the DRM info is known.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

10: the callback that will be run

setOnDrmInfoListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

7

Register a callback to be invoked when the DRM info is known.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

10: the callback that will be run

public static final int MEDIA_INFO_BAD_INTERLEAVING

13

public static final int MEDIA_INFO_BAD_INTERLEAVING

14

setOnDrmPreparedListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

8

Register a callback to be invoked when the DRM object is prepared.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

16: the callback that will be run

public static final int MEDIA_INFO_BAD_INTERLEAVING

13

public static final int MEDIA_INFO_BAD_INTERLEAVING

14: the Handler that will receive the callback

setOnDrmPreparedListener

public static final int MEDIA_INFO_BAD_INTERLEAVING

9

Register a callback to be invoked when the DRM object is prepared.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

16: the callback that will be run

setOnErrorListener

public static final int MEDIA_INFO_BUFFERING_END

0

Register a callback to be invoked when an error has happened during an asynchronous operation.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

22: the callback that will be run

setOnInfoListener

public static final int MEDIA_INFO_BUFFERING_END

1

Register a callback to be invoked when an info/warning is available.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

24: the callback that will be run

setOnMediaTimeDiscontinuityListener

public static final int MEDIA_INFO_BUFFERING_END

2

Sets the listener to be invoked when a media time discontinuity is encountered.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

26: the listener called after a discontinuity This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_INFO_BAD_INTERLEAVING

13

public static final int MEDIA_INFO_BAD_INTERLEAVING

14: the

public static final int MEDIA_INFO_BAD_INTERLEAVING

30 that receives the listener events This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

setOnMediaTimeDiscontinuityListener

public static final int MEDIA_INFO_BUFFERING_END

3

Sets the listener to be invoked when a media time discontinuity is encountered. The listener will be called on the same thread as the one in which the MediaPlayer was created.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

26: the listener called after a discontinuity This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

setOnPreparedListener

public static final int MEDIA_INFO_BUFFERING_END

4

Register a callback to be invoked when the media source is ready for playback.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

36: the callback that will be run

setOnSeekCompleteListener

public static final int MEDIA_INFO_BUFFERING_END

5

Register a callback to be invoked when a seek operation has been completed.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

38: the callback that will be run

setOnSubtitleDataListener

public static final int MEDIA_INFO_BUFFERING_END

6

Sets the listener to be invoked when a subtitle track has new data available. The subtitle data comes from a subtitle track previously selected with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

95. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to determine which tracks are subtitles (of type

public static final int MEDIA_ERROR_UNSUPPORTED

33), Subtitle track encodings can be determined by

public static final int MEDIA_INFO_BAD_INTERLEAVING

42). See

public static final int MEDIA_INFO_BAD_INTERLEAVING

43 for an example of querying subtitle encoding. The listener will be called on the same thread as the one in which the MediaPlayer was created.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

45: the listener called when new data is available This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

setOnSubtitleDataListener

public static final int MEDIA_INFO_BUFFERING_END

7

Sets the listener to be invoked when a subtitle track has new data available. The subtitle data comes from a subtitle track previously selected with

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

95. Use

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

94 to determine which tracks are subtitles (of type

public static final int MEDIA_ERROR_UNSUPPORTED

33), Subtitle track encodings can be determined by

public static final int MEDIA_INFO_BAD_INTERLEAVING

42). See

public static final int MEDIA_INFO_BAD_INTERLEAVING

43 for an example of querying subtitle encoding.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

45: the listener called when new data is available This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80.

public static final int MEDIA_INFO_BAD_INTERLEAVING

13

public static final int MEDIA_INFO_BAD_INTERLEAVING

14: the

public static final int MEDIA_INFO_BAD_INTERLEAVING

30 that receives the listener events This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

setOnTimedMetaDataAvailableListener

public static final int MEDIA_INFO_BUFFERING_END

8

Register a callback to be invoked when a selected track has timed metadata available.

Currently only HTTP live streaming data URI's embedded with timed ID3 tags generates

public static final int MEDIA_INFO_BAD_INTERLEAVING

59.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

61: the callback that will be run

setOnTimedTextListener

public static final int MEDIA_INFO_BUFFERING_END

9

Register a callback to be invoked when a timed text is available for display.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

63: the callback that will be run

setOnVideoSizeChangedListener

public static final int MEDIA_ERROR_MALFORMED

00

Register a callback to be invoked when the video size is known or updated.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

02

public static final int MEDIA_INFO_BAD_INTERLEAVING

65: the callback that will be run

setPlaybackParams

public static final int MEDIA_ERROR_MALFORMED

01

Sets playback rate using

public static final int MEDIA_ERROR_TIMED_OUT

12. The object sets its internal PlaybackParams to the input, except that the object remembers previous speed when input speed is zero. This allows the object to resume at previous speed when start() is called. Calling it before the object is prepared does not change the object state. After the object is prepared, calling it with zero speed is equivalent to calling pause(). After the object is prepared, calling it with non-zero speed is equivalent to calling start().

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

67

public static final int MEDIA_INFO_BAD_INTERLEAVING

68: the playback params. This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized or has been released.

public static final int MEDIA_ERROR_TIMED_OUT

96 if params is not supported.

setPreferredDevice

public static final int MEDIA_ERROR_MALFORMED

02

Specifies an audio device (via an

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 object) to route the output from this MediaPlayer.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

73

public static final int MEDIA_INFO_BAD_INTERLEAVING

74: The

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 specifying the audio sink or source. If deviceInfo is null, default routing is restored. Returns

public static final int MEDIA_ERROR_UNSUPPORTED

49 true if succesful, false if the specified

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

91 is non-null and does not correspond to a valid audio device.

setScreenOnWhilePlaying

public static final int MEDIA_ERROR_MALFORMED

03

Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring. This is the preferred method over

public static final int MEDIA_INFO_BAD_INTERLEAVING

78 where possible, since it doesn't require that the application have permission for low-level wake lock access.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

79

public static final int MEDIA_ERROR_UNSUPPORTED

49: Supply true to keep the screen on, false to allow it to turn off.

setSurface

public static final int MEDIA_ERROR_MALFORMED

04

Sets the

public static final int MEDIA_ERROR_TIMED_OUT

20 to be used as the sink for the video portion of the media. This is similar to

public static final int MEDIA_INFO_BAD_INTERLEAVING

82, but does not support

public static final int MEDIA_INFO_BAD_INTERLEAVING

83. Setting a Surface will un-set any Surface or SurfaceHolder that was previously set. A null surface will result in only the audio track being played. If the Surface sends frames to a

public static final int MEDIA_INFO_BAD_INTERLEAVING

84, the timestamps returned from

public static final int MEDIA_INFO_BAD_INTERLEAVING

85 will have an unspecified zero point. These timestamps cannot be directly compared between different media sources, different instances of the same media source, or multiple runs of the same program. The timestamp is normally monotonically increasing and is unaffected by time-of-day adjustments, but it is reset when the position is set.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

86

public static final int MEDIA_INFO_BAD_INTERLEAVING

87: The

public static final int MEDIA_ERROR_TIMED_OUT

20 to be used for the video portion of the media. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized or has been released.

setSyncParams

public static final int MEDIA_ERROR_MALFORMED

05

Sets A/V sync mode.

Parameters

public static final int MEDIA_INFO_BAD_INTERLEAVING

67

public static final int MEDIA_INFO_BAD_INTERLEAVING

91: the A/V sync params to apply This value cannot be

public static final int MEDIA_ERROR_UNKNOWN

80. Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized.

public static final int MEDIA_ERROR_TIMED_OUT

96 if params are not supported.

setVideoScalingMode

public static final int MEDIA_ERROR_MALFORMED

06

Sets video scaling mode. To make the target video scaling mode effective during playback, this method must be called after data source is set. If not called, the default video scaling mode is

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

27.

The supported video scaling modes are:

  • public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK 27
  • public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK 29 Parameters

public static final int MEDIA_ERROR_UNSUPPORTED

94

public static final int MEDIA_ERROR_MALFORMED

62: target video scaling mode. Must be one of the supported video scaling modes; otherwise, IllegalArgumentException will be thrown.

setVolume

public static final int MEDIA_ERROR_MALFORMED

07

Sets the volume on this player. This API is recommended for balancing the output of audio streams within an application. Unless you are writing an application to control user settings, this API should be used in preference to

public static final int MEDIA_INFO_BUFFERING_END

00 which sets the volume of ALL streams of a particular type. Note that the passed volume values are raw scalars in range 0.0 to 1.0. UI controls should be scaled logarithmically.

Parameters

public static final int MEDIA_INFO_BUFFERING_END

01

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

31: left volume scalar

public static final int MEDIA_INFO_BUFFERING_END

03

public static final int MEDIA_INFO_AUDIO_NOT_PLAYING

31: right volume scalar

setWakeMode

public static final int MEDIA_ERROR_MALFORMED

08

Set the low-level power management behavior for this MediaPlayer. This can be used when the MediaPlayer is not playing through a SurfaceHolder set with

public static final int MEDIA_INFO_BAD_INTERLEAVING

82 and thus can use the high-level

public static final int MEDIA_INFO_BAD_INTERLEAVING

83 feature.

This function has the MediaPlayer access the low-level power manager service to control the device's power usage while playing is occurring. The parameter is a combination of

public static final int MEDIA_INFO_BUFFERING_END

07 wake flags. Use of this method requires

public static final int MEDIA_INFO_BUFFERING_END

08 permission. By default, no attempt is made to keep the device awake during playback.

Parameters

public static final int MEDIA_ERROR_TIMED_OUT

87

public static final int MEDIA_ERROR_TIMED_OUT

88: the Context to use

public static final int MEDIA_ERROR_UNSUPPORTED

94

public static final int MEDIA_ERROR_MALFORMED

62: the power/wake mode to set

start

public static final int MEDIA_ERROR_MALFORMED

09

Starts or resumes playback. If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.

Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if it is called in an invalid state

stop

public static final int MEDIA_ERROR_MALFORMED

10

Stops playback after playback has been started or paused.

Throws

public static final int MEDIA_ERROR_TIMED_OUT

97 if the internal player engine has not been initialized.

Protected methods

finalize

public static final int MEDIA_ERROR_MALFORMED

11

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the

public static final int MEDIA_INFO_BUFFERING_END

15 method to dispose of system resources or to perform other cleanup.

The general contract of

public static final int MEDIA_INFO_BUFFERING_END

15 is that it is invoked if and when the Java™ virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The

public static final int MEDIA_INFO_BUFFERING_END

15 method may take any action, including making this object available again to other threads; the usual purpose of

public static final int MEDIA_INFO_BUFFERING_END

15, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The

public static final int MEDIA_INFO_BUFFERING_END

15 method of class

public static final int MEDIA_ERROR_TIMED_OUT

44 performs no special action; it simply returns normally. Subclasses of

public static final int MEDIA_ERROR_TIMED_OUT

44 may override this definition.

The Java programming language does not guarantee which thread will invoke the

public static final int MEDIA_INFO_BUFFERING_END

15 method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the

public static final int MEDIA_INFO_BUFFERING_END

15 method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The

public static final int MEDIA_INFO_BUFFERING_END

15 method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the

public static final int MEDIA_INFO_BUFFERING_END

15 method causes the finalization of this object to be halted, but is otherwise ignored.