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

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

MediaPlayer setOnErrorListener examples from Open Source projects
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener
30:	player = new MediaPlayer(); 
-
38:	player.setOnCompletionListener(new OnCompletionListener() { 
-
46:	player.setOnErrorListener(new OnErrorListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setDataSource, setLooping, setOnErrorListener
61:	MediaPlayer newPlayer = new MediaPlayer(); 
-
64:	newPlayer.setOnErrorListener(playerErrorListener); 
65:	newPlayer.setDataSource(context, ringtoneUri); 
66:	newPlayer.setLooping(true); 
67:	newPlayer.setAudioStreamType(AudioManager.STREAM_RING); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
22:	mMediaPlayer = new MediaPlayer(); 
23:	mMediaPlayer.setOnBufferingUpdateListener(this); 
24:	mMediaPlayer.setOnCompletionListener(this); 
25:	mMediaPlayer.setOnPreparedListener(this); 
26:	mMediaPlayer.setOnErrorListener(this); 
27:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnCompletionListener, setOnErrorListener, start
214:	mPlayer = new MediaPlayer(); 
-
216:	mPlayer.setDataSource(mSampleFile.getAbsolutePath()); 
217:	mPlayer.setOnCompletionListener(this); 
218:	mPlayer.setOnErrorListener(this); 
219:	mPlayer.prepare(); 
220:	mPlayer.start(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener
133:	player.setOnCompletionListener(onCompletionListener); 
-
135:	player.setOnErrorListener(onErrorListener); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
297:	mPlayer = new MediaPlayer(); 
-
300:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
303:	mPlayer.setOnPreparedListener(this); 
304:	mPlayer.setOnCompletionListener(this); 
305:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnErrorListener, setOnPreparedListener
126:	mMediaPlayer = new MediaPlayer(); 
127:	mMediaPlayer.setOnErrorListener(this); 
128:	mMediaPlayer.setOnPreparedListener(this); 
-
130:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
131:	mMediaPlayer.setVolume(1.0f, 1.0f); 
-
133:	mMediaPlayer.setDataSource(this, Uri.parse(urlToStream)); 
-
141:	mMediaPlayer.prepareAsync(); // prepare async to not block main thread 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
73:	m_media_player = new MediaPlayer(); 
74:	m_media_player.setDataSource(url_string); 
75:	m_media_player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
76:	m_media_player.setOnPreparedListener(this); 
77:	m_media_player.setOnCompletionListener(this); 
78:	m_media_player.setOnErrorListener(this); 
79:	m_media_player.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnErrorListener
210:	MediaPlayer mPlayer = new MediaPlayer(); 
211:	mPlayer.setOnErrorListener( 
-
223:	mPlayer.setDataSource(fis.getFD()); 
224:	mPlayer.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
161:	mPlayer = new MediaPlayer(); 
-
168:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
172:	mPlayer.setOnPreparedListener(this); 
173:	mPlayer.setOnCompletionListener(this); 
174:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnCompletionListener, setOnErrorListener, start
182:	mPlayer = new MediaPlayer(); 
-
184:	mPlayer.setDataSource(mSampleFile.getAbsolutePath()); 
185:	mPlayer.setOnCompletionListener(this); 
186:	mPlayer.setOnErrorListener(this); 
187:	mPlayer.prepare(); 
188:	mPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnErrorListener
164:	super(player, service); 
165:	player.setOnErrorListener(onError); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnCompletionListener, setOnErrorListener, start
93:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
94:	mMediaPlayer.setOnCompletionListener(new OnCompletionListener() { 
-
99:	mMediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
107:	mMediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setOnSeekCompleteListener
59:	androidMediaPlayer.setOnPreparedListener(this); 
60:	androidMediaPlayer.setOnBufferingUpdateListener(this); 
61:	androidMediaPlayer.setOnCompletionListener(this); 
62:	androidMediaPlayer.setOnSeekCompleteListener(this); 
63:	androidMediaPlayer.setOnErrorListener(this); 
Full Snippet Info
6
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, 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: prepareAsync, setDataSource, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
120:	mMediaPlayer = new MediaPlayer(); 
121:	mMediaPlayer.setOnPreparedListener(this); 
122:	mMediaPlayer.setOnCompletionListener(this); 
123:	mMediaPlayer.setOnErrorListener(this); 
-
134:	mMediaPlayer.setDataSource(mMediaLocation); 
135:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
138:	mPlayer = new MediaPlayer(); 
-
145:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
149:	mPlayer.setOnPreparedListener(this); 
150:	mPlayer.setOnCompletionListener(this); 
151:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnCompletionListener, setOnErrorListener, start
91:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
92:	mMediaPlayer.setOnCompletionListener(new OnCompletionListener() { 
-
97:	mMediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
105:	mMediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
168:	mPlayer = new MediaPlayer(); 
-
178:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
183:	mPlayer.setOnPreparedListener(this); 
184:	mPlayer.setOnCompletionListener(this); 
185:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setOnErrorListener, setOnPreparedListener, setVolume, setWakeMode
98:	mp.setVolume(1.0f, 1.0f); 
-
134:	mp = new MediaPlayer(); 
135:	mp.setOnPreparedListener(new OnPreparedListener() 
-
142:	mp.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
143:	mp.setOnErrorListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
163:	mPlayer = new MediaPlayer(); 
-
170:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
174:	mPlayer.setOnPreparedListener(this); 
175:	mPlayer.setOnCompletionListener(this); 
176:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, setOnCompletionListener, setOnErrorListener
123:	mMediaPlayer = new MediaPlayer(); 
124:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
-
126:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
127:	mMediaPlayer.setOnErrorListener(mErrorListener); 
128:	mMediaPlayer.setDataSource(mContext, mUri); 
129:	mMediaPlayer.setDisplay(mSurfaceHolder); 
130:	mMediaPlayer.setScreenOnWhilePlaying(true); 
131:	mMediaPlayer.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
41:	_mediaPlayer = new MediaPlayer(); 
42:	_mediaPlayer.setOnErrorListener(this); 
43:	_mediaPlayer.setOnCompletionListener(this); 
44:	_mediaPlayer.setOnBufferingUpdateListener(this); 
45:	_mediaPlayer.setOnPreparedListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnCompletionListener, setOnErrorListener, start
165:	mPlayer = new MediaPlayer(); 
-
167:	mPlayer.setDataSource(mSampleFile.getAbsolutePath()); 
168:	mPlayer.setOnCompletionListener(this); 
169:	mPlayer.setOnErrorListener(this); 
170:	mPlayer.prepare(); 
171:	mPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
106:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
107:	mp.setOnPreparedListener(this); 
108:	mp.setOnErrorListener(this); 
109:	mp.setDataSource("http://74.222.1.197:13588"); 
-
111:	mp.prepareAsync(); 
112:	mp.setOnCompletionListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setLooping, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener
20:	mp = new MediaPlayer(); 
21:	mp.setOnErrorListener(this); 
22:	mp.setOnBufferingUpdateListener(this); 
23:	mp.setOnCompletionListener(this); 
24:	mp.setOnPreparedListener(this); 
25:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
26:	mp.setLooping(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: reset, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
101:	m_player.setOnPreparedListener(this); 
102:	m_player.setOnCompletionListener(this); 
103:	m_player.setOnErrorListener(this); 
104:	m_player.setAudioStreamType(AudioManager.STREAM_ALARM); 
105:	m_player.reset(); 
-
128:	m_player.setDataSource(this, soundUri); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
161:	mPlayer = new MediaPlayer(); 
-
168:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
172:	mPlayer.setOnPreparedListener(this); 
173:	mPlayer.setOnCompletionListener(this); 
174:	mPlayer.setOnErrorListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
166:	this.mediaPlayer = new MediaPlayer(); 
-
168:	this.mediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
170:	this.mediaPlayer.setOnPreparedListener(this); 
171:	this.mediaPlayer.setOnCompletionListener(this); 
172:	this.mediaPlayer.setOnErrorListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setOnErrorListener, setOnPreparedListener, setWakeMode
142:	mPlayer = new MediaPlayer(); 
-
149:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
153:	mPlayer.setOnPreparedListener(this); 
154:	mPlayer.setOnCompletionListener(this); 
155:	mPlayer.setOnErrorListener(this); 
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: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
78:	this.mediaPlayer = new MediaPlayer(); 
79:	this.mediaPlayer.setDataSource(path); 
80:	this.mediaPlayer.setDisplay(this.surfaceHolder); 
81:	this.mediaPlayer.prepare(); 
82:	this.mediaPlayer.setOnBufferingUpdateListener(this); 
83:	this.mediaPlayer.setOnPreparedListener(this); 
84:	this.mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
86:	mediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
105:	mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
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: 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: 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: 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
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
247:	mMediaPlayer = new MediaPlayer(); 
248:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
249:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
253:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
254:	mMediaPlayer.setOnErrorListener(mErrorListener); 
255:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
257:	mMediaPlayer.setDataSource(mContext, mUri); 
258:	mMediaPlayer.setDisplay(mSurfaceHolder); 
259:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
260:	mMediaPlayer.setScreenOnWhilePlaying(true); 
261:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
Related MediaPlayer setOnErrorListener 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...
setOnErrorListener Method Overview
Register a callback to be invoked when an error has happened during an asynchronous operation.
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.
  • setOnInfoListener
    Register a callback to be invoked when an info/warning is available.
  • 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.