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

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

MediaPlayer prepareAsync examples from Open Source projects
This code example shows how to use the following methods: prepareAsync
117:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
77:	mPlayer = new MediaPlayer(); 
-
84:	mPlayer.setDataSource(file); 
85:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
86:	mPlayer.prepareAsync(); 
-
90:	mPlayer.setDataSource("/sdcard/" + file); 
91:	mPlayer.prepare(); 
-
93:	mPlayer.setOnPreparedListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, prepareAsync
34:	if (!media_player.isPlaying()) { 
35:	media_player.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync
302:	player.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnPreparedListener
87:	mediaPlayer = new MediaPlayer(); 
88:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL); 
89:	mediaPlayer.setOnCompletionListener(this); 
90:	mediaPlayer.setOnPreparedListener(this); 
-
96:	mediaPlayer.setDataSource(context, dataUri); 
-
114:	mediaPlayer.prepareAsync(); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource
73:	mMediaPlayer.setDataSource(mAudioTrackURL); 
74:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
77:	mPlayer = new MediaPlayer(); 
-
84:	mPlayer.setDataSource(file); 
85:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
86:	mPlayer.prepareAsync(); 
-
90:	mPlayer.setDataSource("/sdcard/" + file); 
91:	mPlayer.prepare(); 
-
93:	mPlayer.setOnPreparedListener(this); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setLooping, setOnPreparedListener
45:	_mp = new MediaPlayer(); 
-
47:	_mp.setDataSource(uri); 
-
51:	_mp.setDataSource(uri); 
52:	_mp.setOnPreparedListener(this); 
53:	_mp.prepareAsync(); 
-
55:	_mp.setLooping(true); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: prepareAsync, release, reset, setDataSource
592:	MediaPlayer mp = new MediaPlayer(); 
593:	mp.setDataSource(filePath); 
594:	mp.prepareAsync(); 
595:	mp.reset(); 
596:	mp.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, prepareAsync, stop
88:	if (!mMediaPlayer.isPlaying()) { 
-
91:	mMediaPlayer.stop(); 
-
98:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync
73:	player.prepareAsync(); 
Full Snippet Info
6
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: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnPreparedListener
109:	mMediaPlayer.setDataSource(fis.getFD()); 
110:	mMediaPlayer.setDisplay(sHolder); 
-
112:	mMediaPlayer.prepareAsync(); 
-
114:	mMediaPlayer.setOnPreparedListener(new OnPreparedListener() { 
-
137:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync
318:	mp.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setDisplay, setOnCompletionListener, setOnPreparedListener
109:	mediaPlayer.setDisplay(holder); 
110:	mediaPlayer.setDataSource(videoURL); 
111:	mediaPlayer.setOnPreparedListener(new VideoPlayerPrepareListener( 
-
113:	mediaPlayer.setOnCompletionListener(new VideoPlayerOnCompletionListener()); 
114:	mediaPlayer.prepareAsync(); 
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: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
77:	mPlayer = new MediaPlayer(); 
-
84:	mPlayer.setDataSource(file); 
85:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
86:	mPlayer.prepareAsync(); 
-
90:	mPlayer.setDataSource("/sdcard/" + file); 
91:	mPlayer.prepare(); 
-
93:	mPlayer.setOnPreparedListener(this); 
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: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnPreparedListener
15:	player = new MediaPlayer(); 
16:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
18:	player.setDataSource(musicFile); 
19:	player.setOnPreparedListener(this); 
20:	player.setOnCompletionListener(this); 
21:	player.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
73:	mPlayer = new MediaPlayer(); 
-
80:	mPlayer.setDataSource(file); 
81:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
82:	mPlayer.prepareAsync(); 
-
86:	mPlayer.setDataSource("/sdcard/" + file); 
87:	mPlayer.prepare(); 
-
89:	mPlayer.setOnPreparedListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync, setDisplay
94:	mediaPlayer.setDisplay(holder); 
-
98:	mediaPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, release, reset, setDataSource
592:	MediaPlayer mp = new MediaPlayer(); 
593:	mp.setDataSource(filePath); 
594:	mp.prepareAsync(); 
595:	mp.reset(); 
596:	mp.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
77:	mPlayer = new MediaPlayer(); 
-
84:	mPlayer.setDataSource(file); 
85:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
86:	mPlayer.prepareAsync(); 
-
90:	mPlayer.setDataSource("/sdcard/" + file); 
91:	mPlayer.prepare(); 
-
93:	mPlayer.setOnPreparedListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepareAsync, release, setDataSource, setOnPreparedListener
181:	mAudioPlayer = new MediaPlayer(); 
182:	mAudioPlayer.setOnPreparedListener(mPreparedListener); 
183:	mAudioPlayer.setDataSource(this.getContext(), audio); 
184:	mAudioPlayer.prepareAsync(); 
-
187:	mAudioPlayer.release(); 
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: prepareAsync, setDataSource, setOnCompletionListener, setOnPreparedListener
104:	_mediaPlayerCommon = new MediaPlayer(); 
105:	_mediaPlayerCommon.setDataSource(audioUrl); 
106:	_mediaPlayerCommon.prepareAsync(); 
107:	_mediaPlayerCommon.setOnPreparedListener(new OnPreparedListener() { 
-
118:	_mediaPlayerCommon.setOnCompletionListener(new OnCompletionListener() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDisplay
62:	player.setDisplay(holder); 
63:	player.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
39:	mediaPlayer = new MediaPlayer(); 
40:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
41:	mediaPlayer.setDataSource(AMORFM_URL); 
42:	mediaPlayer.setOnPreparedListener(this); 
43:	mediaPlayer.prepareAsync(); // might take long! (for buffering, etc) 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnPreparedListener
61:	player = new MediaPlayer(); 
-
64:	player.setDataSource(this, uri); 
65:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
66:	player.setOnPreparedListener(this); 
67:	player.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, reset, setAudioStreamType, setDataSource, setOnCompletionListener
54:	mMediaPlayer.setOnCompletionListener(this); 
55:	mMediaPlayer.setOnPreparedListener(this); 
56:	mMediaPlayer.prepareAsync(); 
-
61:	mMediaPlayer.reset(); 
-
66:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
67:	mMediaPlayer.setDataSource(fd, afd.getStartOffset(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setLooping, setOnPreparedListener
29:	mediaPlayer = new MediaPlayer(); 
30:	mediaPlayer.setDataSource(audioFile); 
31:	mediaPlayer.prepareAsync(); 
32:	mediaPlayer.setOnPreparedListener(this); 
33:	mediaPlayer.setLooping(false); // Set looping 
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: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
161:	mPlayer = new MediaPlayer(); 
-
168:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
172:	mPlayer.setOnPreparedListener(this); 
173:	mPlayer.setOnCompletionListener(this); 
174:	mPlayer.setOnErrorListener(this); 
-
277:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
278:	mPlayer.setDataSource(getApplicationContext(), getCurrentItem().getURI()); 
-
287:	mPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setOnBufferingUpdateListener, setOnCompletionListener, setOnPreparedListener
113:	mMediaPlayer = new MediaPlayer(); 
114:	mMediaPlayer.setOnBufferingUpdateListener(mMediaHandler); 
115:	mMediaPlayer.setOnCompletionListener(mMediaHandler); 
116:	mMediaPlayer.setOnPreparedListener(mMediaHandler); 
117:	mMediaPlayer.setOnSeekCompleteListener(mMediaHandler); 
118:	mMediaPlayer.setDataSource(url); 
119:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
142:	mPlayer = new MediaPlayer(); 
-
149:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
153:	mPlayer.setOnPreparedListener(this); 
154:	mPlayer.setOnCompletionListener(this); 
155:	mPlayer.setOnErrorListener(this); 
-
377:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
378:	mPlayer.setDataSource(getApplicationContext(), item.getURI()); 
-
391:	mPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setOnCompletionListener, setOnErrorListener
168:	mPlayer = new MediaPlayer(); 
-
178:	mPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); 
-
183:	mPlayer.setOnPreparedListener(this); 
184:	mPlayer.setOnCompletionListener(this); 
185:	mPlayer.setOnErrorListener(this); 
-
446:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
447:	mPlayer.setDataSource(getApplicationContext(), item.getURI()); 
-
462:	mPlayer.prepareAsync(); 
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: 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 prepareAsync Questions & Answers:
prepareAsync Method Overview
Prepares the player for playback, asynchronously.
See Also