Best code examples for MediaPlayer setOnInfoListener method (android.media.MediaPlayer.setOnInfoListener)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer setOnInfoListener method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

MediaPlayer setOnInfoListener examples from Open Source projects
This code example shows how to use the following methods: setOnInfoListener
213:	player.setOnInfoListener(listener); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setOnCompletionListener, setOnErrorListener, setOnInfoListener
29:	player = new MediaPlayer(); 
30:	player.setDataSource(path); 
-
32:	player.setOnPreparedListener(listenerActivity); 
33:	player.setOnInfoListener(listenerActivity); 
34:	player.setOnErrorListener(listenerActivity); 
35:	player.setOnCompletionListener(listenerActivity); 
-
44:	player.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
50:	mMediaPlayer = new MediaPlayer(); 
51:	mMediaPlayer.setOnBufferingUpdateListener(this); 
52:	mMediaPlayer.setOnCompletionListener(this); 
53:	mMediaPlayer.setOnErrorListener(this); 
54:	mMediaPlayer.setOnInfoListener(this); 
55:	mMediaPlayer.setOnPreparedListener(this); 
56:	mMediaPlayer.setOnSeekCompleteListener(this); 
57:	mMediaPlayer.setOnVideoSizeChangedListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setOnCompletionListener, setOnInfoListener, setOnPreparedListener
64:	mMediaPlayer = new MediaPlayer(); 
65:	mMediaPlayer.setOnCompletionListener(mMediaPlayerOnCompletionListener); 
66:	mMediaPlayer.setOnPreparedListener(mMediaPlayerOnPreparedListener); 
67:	mMediaPlayer.setOnInfoListener(mMediaPlayerOnInfoListener); 
-
72:	mMediaPlayer.setDataSource(mAudio.getUrl()); 
73:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplay, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener
52:	player = new MediaPlayer(); 
-
54:	player.setDisplay(holder); 
55:	player.setScreenOnWhilePlaying(true); 
56:	player.setOnPreparedListener(this); 
57:	player.setOnBufferingUpdateListener(this); 
58:	player.setOnErrorListener(this); 
59:	player.setOnCompletionListener(this); 
60:	player.setOnInfoListener(this); 
61:	player.setOnSeekCompleteListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
141:	mediaPlayer = new MediaPlayer(); 
142:	mediaPlayer.setOnBufferingUpdateListener(this); 
143:	mediaPlayer.setOnCompletionListener(this); 
144:	mediaPlayer.setOnErrorListener(this); 
145:	mediaPlayer.setOnInfoListener(this); 
146:	mediaPlayer.setOnPreparedListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnBufferingUpdateListener, setOnCompletionListener
63:	mMediaPlayer = new MediaPlayer(); 
64:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
66:	mMediaPlayer.setDataSource(radio.getUrl()); 
-
72:	mMediaPlayer.setOnBufferingUpdateListener(this); 
73:	mMediaPlayer.setOnInfoListener(this); 
74:	mMediaPlayer.setOnPreparedListener(this); 
75:	mMediaPlayer.setOnErrorListener(this); 
76:	mMediaPlayer.setOnCompletionListener(this); 
77:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnBufferingUpdateListener, setOnCompletionListener
66:	mMediaPlayer = new MediaPlayer(); 
67:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
69:	mMediaPlayer.setDataSource(kajian.getLink()); 
-
74:	mMediaPlayer.setOnBufferingUpdateListener(this); 
75:	mMediaPlayer.setOnInfoListener(this); 
76:	mMediaPlayer.setOnPreparedListener(this); 
77:	mMediaPlayer.setOnErrorListener(this); 
78:	mMediaPlayer.setOnCompletionListener(this); 
79:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setLooping, setOnInfoListener, setOnSeekCompleteListener
81:	mediaPlayer.setLooping( isLooping ); 
-
100:	mediaPlayer.setOnSeekCompleteListener( this ); 
101:	mediaPlayer.setOnInfoListener( this ); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener, setOnPreparedListener
180:	mMediaPlayer = new MediaPlayer(); 
181:	mMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
182:	mMediaPlayer.setOnBufferingUpdateListener(this); 
183:	mMediaPlayer.setOnCompletionListener(this); 
184:	mMediaPlayer.setOnErrorListener(this); 
185:	mMediaPlayer.setOnInfoListener(this); 
186:	mMediaPlayer.setOnPreparedListener(this); 
187:	mMediaPlayer.setOnSeekCompleteListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isPlaying, prepareAsync, release, setDataSource, setOnCompletionListener
78:	mediaPlayer = new MediaPlayer(); 
-
80:	.setOnCompletionListener((OnCompletionListener) rootActivity); 
-
82:	.setOnErrorListener((OnErrorListener) rootActivity); 
-
84:	.setOnInfoListener((OnInfoListener) rootActivity); 
-
86:	.setOnPreparedListener((OnPreparedListener) rootActivity); 
-
88:	mediaPlayer.setDataSource(STREAM_URI); 
-
90:	onError(mediaPlayer, -1, -1); 
-
93:	onError(mediaPlayer, -1, -1); 
-
96:	onError(mediaPlayer, -1, -1); 
-
102:	if (isPlaying || (mediaPlayer != null && mediaPlayer.isPlaying()) ) { 
-
104:	if(mediaPlayer.isPlaying()){ 
105:	mediaPlayer.stop(); 
-
107:	mediaPlayer.release(); 
-
116:	mediaPlayer.prepareAsync(); 
-
120:	onError(mediaPlayer, -1, -1); 
Full Snippet Info
4
CodeRank
Related MediaPlayer setOnInfoListener Questions & Answers:
MediaPlayer class can be used to control playback of audio/video files and streams. An example on how to use the methods in this class can be found in VideoView.

Topics covered here are: State Diagram Valid and Invalid States Permissions Register informational and error callbacks Developer Guides For more information about how to use MediaPlayer, read the Media Playback developer guide. State Diagram Playback control of audio/video files and streams is managed as a state machine. The following diagram shows the life cycle and the states of a MediaPlayer object driven by the supported playback control operations. The ovals represent the states a MediaPlayer object may reside in. The arcs represent the playback control operations that drive the object state transition. There are two types of arcs. The arcs with a single arrow head represent synchronous method calls, while those with a double arrow head represent asynchronous method calls.From this state diagram, one can...
setOnInfoListener Method Overview
Register a callback to be invoked when an info/warning is available.
See Also
  • isLooping
    Checks whether the MediaPlayer is looping or non-looping.
  • isPlaying
    Checks whether the MediaPlayer is playing.
  • prepare
    Prepares the player for playback, synchronously.
  • prepareAsync
    Prepares the player for playback, asynchronously.
  • release
    Releases resources associated with this MediaPlayer object.
  • reset
    Resets the MediaPlayer to its uninitialized state.
  • seekTo
    Seeks to specified time position.
  • setDataSource
    Sets the data source (file-path or http/rtsp URL) to use.
  • setDisplay
    Sets the SurfaceHolder to use for displaying the video portion of the media.
  • setLooping
    Sets the player to be looping or non-looping.
  • setOnCompletionListener
    Register a callback to be invoked when the end of a media source has been reached during playback.
  • setOnErrorListener
    Register a callback to be invoked when an error has happened during an asynchronous operation.
  • setScreenOnWhilePlaying
    Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring.
  • setWakeMode
    Set the low-level power management behavior for this MediaPlayer.
  • start
    Starts or resumes playback.
  • stop
    Stops playback after playback has been stopped or paused.