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

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

MediaPlayer setVolume examples from Open Source projects
This code example shows how to use the following methods: prepare, setDataSource, setVolume
25:	player = new MediaPlayer(); 
26:	player.setDataSource(fileName); 
27:	player.prepare(); 
-
91:	if(player!=null) player.setVolume(leftVolume, rightVolume); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnCompletionListener, setVolume, start
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
This code example shows how to use the following methods: prepare, setDataSource, setVolume
140:	mediaPlayer = new MediaPlayer(); 
141:	mediaPlayer.setDataSource(assetFileDescritor.getFileDescriptor(), 
-
143:	mediaPlayer.prepare(); 
-
145:	mediaPlayer.setVolume(mLeftVolume, mRightVolume); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, setLooping, setVolume, start
44:	mp.setLooping(false); 
-
52:	if (!mp.isPlaying()) { 
-
55:	mp.setVolume(pct, pct); 
56:	mp.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, setVolume
388:	if (mPlayer.isPlaying()) { 
-
394:	mPlayer.setVolume(DUCK_VOLUME, DUCK_VOLUME); 
-
397:	mPlayer.setVolume(1.0f, 1.0f); // full volume 
-
400:	if (!mPlayer.isPlaying()) { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLooping, setVolume, start
221:	mMediaPlayer.setVolume((float)inVolLeft,(float)inVolRight); 
-
223:	mMediaPlayer.setLooping(true); 
-
227:	mMediaPlayer.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setVolume
81:	_mp.setVolume(fval, fval); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource, setLooping, setVolume
49:	mp.reset(); 
50:	mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getDeclaredLength()); 
51:	mp.prepare(); 
52:	mp.setVolume(0.5f, 0.5f); 
53:	mp.setLooping(repeat); 
54:	mp.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setOnCompletionListener, setVolume
161:	mediaPlayer = new MediaPlayer(); 
162:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
163:	mediaPlayer.setOnCompletionListener(beepListener); 
-
167:	mediaPlayer.setDataSource(file.getFileDescriptor(), 
-
170:	mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME); 
171:	mediaPlayer.prepare(); 
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: setLooping, setVolume, start
93:	mPlayer.setLooping(boLoop); 
94:	mPlayer.setVolume(streamVolume, streamVolume); 
95:	mPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, setVolume
369:	mPlayer.setVolume(1.0f, 1.0f); // we can be loud 
-
371:	if (!mPlayer.isPlaying()) mPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLooping, setOnCompletionListener, setVolume
38:	mp.setLooping(true); 
-
41:	mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
-
61:	mp.setVolume((float)leftVol, (float)rightVol); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setVolume
77:	mediaPlayer.setVolume(volume * globalVolume, volume * globalVolume); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setOnCompletionListener, setVolume
165:	mediaPlayer = new MediaPlayer(); 
166:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
167:	mediaPlayer.setOnCompletionListener(beepListener); 
-
171:	mediaPlayer.setDataSource(file.getFileDescriptor(), 
-
174:	mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME); 
175:	mediaPlayer.prepare(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLooping, setOnCompletionListener, setVolume
38:	mp.setLooping(true); 
-
41:	mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
-
61:	mp.setVolume((float)leftVol, (float)rightVol); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, release, setDataSource, setVolume
31:	androidPlayer.release(); 
-
45:	androidPlayer = new MediaPlayer(); 
-
52:	androidPlayer.setDataSource(in); 
-
54:	androidPlayer.prepare(); 
55:	androidPlayer.setVolume(volume / 100f, volume / 100f); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setVolume
175:	mediaPlayer = new MediaPlayer(); 
-
178:	mediaPlayer.setDataSource(path); 
179:	mediaPlayer.prepare(); 
-
181:	mediaPlayer.setVolume(mLeftVolume, mRightVolume); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setOnCompletionListener, setVolume
256:	mMP = new MediaPlayer(); 
257:	mMP.setOnCompletionListener( new CompletionListener() ); 
-
261:	mMP.setDataSource( fileInStream.getFD() ); 
-
264:	mMP.setVolume(1, 1); 
-
268:	mMP.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, release, setDataSource, setVolume
26:	androidPlayer.release(); 
-
42:	androidPlayer = new MediaPlayer(); 
-
49:	androidPlayer.setDataSource(in); 
-
51:	androidPlayer.prepare(); 
52:	androidPlayer.setVolume(volume / 100f, volume / 100f); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, setLooping, setVolume, start
52:	if (mp.isPlaying()) { 
-
55:	mp.stop(); 
56:	mp.prepare(); 
-
60:	mp.setVolume(volume, volume); 
61:	mp.start(); 
62:	mp.setLooping(loop); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setOnCompletionListener, setVolume
98:	MediaPlayer mediaPlayer = new MediaPlayer(); 
99:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
101:	mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
-
108:	mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength()); 
-
110:	mediaPlayer.setVolume(SOUND_VOLUME, SOUND_VOLUME); 
111:	mediaPlayer.prepare(); 
Full Snippet Info
6
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: setAudioStreamType, setOnCompletionListener, setOnPreparedListener, setVolume
32:	mediaPlayer = new MediaPlayer(); 
33:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
34:	mediaPlayer.setVolume(1.0f, 1.0f); 
35:	mediaPlayer.setOnPreparedListener(this); 
36:	mediaPlayer.setOnCompletionListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, seekTo, setLooping, setVolume, start
123:	if (!startScreenLoop.isPlaying()) 
-
125:	startScreenLoop.seekTo(0); 
126:	startScreenLoop.setLooping(true); 
-
128:	startScreenLoop.setVolume(volume, volume); 
129:	startScreenLoop.start(); 
Full Snippet Info
6
CodeRank
Related MediaPlayer setVolume Questions & Answers:
setVolume Method Overview
Sets the volume on this player.
See Also