Code examples for Playing audio and video

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
105:	mp.setLooping(true); 
106:	mp.seekTo(0); 
107:	mp.start(); 
Full Snippet Info
10
CodeRank
62:	MediaPlayer mediaPlayer = new MediaPlayer(); 
-
65:	mediaPlayer.setDataSource(file); 
66:	mediaPlayer.prepare(); 
67:	mediaPlayer.start(); 
Full Snippet Info
10
CodeRank
100:	mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
-
103:	mPlayer.setDataSource(this, url); 
104:	mPlayer.prepare(); 
105:	mPlayer.setLooping(true); 
106:	mPlayer.start(); 
Full Snippet Info
8
CodeRank
155:	mPlayer.setOnCompletionListener(this); 
156:	mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() 
-
164:	mPlayer.start(); 
Full Snippet Info
8
CodeRank
51:	MediaPlayer mp = new MediaPlayer(); 
52:	mp.setDataSource(filePath); 
53:	mp.prepare(); 
54:	mp.start(); 
55:	Thread.sleep(200000); 
56:	mp.stop(); 
57:	mp.release(); 
Full Snippet Info
8
CodeRank
38:	mMediaPlayer.start(); 
Full Snippet Info
8
CodeRank
52:	player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
-
58:	player.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength()); 
-
60:	player.setVolume(0.2f, 0.2f); 
61:	player.prepare(); 
62:	player.start(); 
Full Snippet Info
8
CodeRank
573:	MediaPlayer mp = new MediaPlayer(); 
574:	mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(), afd.getLength()); 
575:	mp.prepare(); 
576:	mp.start(); 
577:	duration = mp.getDuration(); 
578:	Thread.sleep(5000); 
579:	mp.release(); 
Full Snippet Info
8
CodeRank
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
66:	mediaPlayer.start(); 
Full Snippet Info
8
CodeRank