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

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

MediaPlayer isPlaying examples from Open Source projects
This code example shows how to use the following methods: isPlaying, release, stop
30:	if (mediaPlayer.isPlaying()) 
31:	mediaPlayer.stop(); 
32:	mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying
82:	return (fileName.equals(currentTrack) && mediaPlayer.isPlaying()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
150:	if (mediaPlayer.isPlaying()) { 
-
152:	mediaPlayer.stop(); 
-
155:	mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, stop
40:	if (player.isPlaying()) { 
41:	player.stop(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying
71:	assertFalse("SoundManager provided a MediaPlayer that was already playing", mediaPlayer.isPlaying()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
111:	if (mMediaPlayer.isPlaying()) { 
112:	mMediaPlayer.stop(); 
-
114:	mMediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying
80:	return mp.isPlaying(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
96:	if (player.isPlaying()) { 
97:	player.stop(); 
-
99:	player.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isLooping, isPlaying, pause, seekTo
75:	if ( mp.isLooping() || mp.isPlaying() ) 
-
78:	mp.pause(); 
79:	mp.seekTo(0); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: isPlaying, stop
174:	if (mMediaPlayer.isPlaying()) 
-
176:	mMediaPlayer.stop(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, setAudioStreamType, setDataSource, start
151:	return player != null && player.isPlaying(); 
-
184:	player.setDataSource(s); 
185:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
186:	player.prepare(); 
-
191:	player.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, setAudioStreamType, setDataSource, setLooping, setOnErrorListener
96:	if(!player.isPlaying()) { 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
93:	if(mediaPlayer.isPlaying()){ 
94:	mediaPlayer.stop(); 
95:	mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, seekTo, stop
103:	if(mPlayer.isPlaying()) 
-
105:	mPlayer.stop(); 
-
108:	mPlayer.prepare(); 
109:	mPlayer.seekTo(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDuration, isPlaying, seekTo, start
61:	player.start(); 
-
152:	if(stream && player!=null) player.seekTo((int) (player.getDuration()*pct)); // 0 = start, 1 = end; 
-
175:	return player!=null && player.isPlaying(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCurrentPosition, getDuration, isPlaying, prepare, setDataSource
409:	MediaPlayer mp = new MediaPlayer(); 
-
411:	mp.setDataSource(filePath); 
-
413:	mp.prepare(); 
414:	duration = mp.getDuration(); 
415:	mp.start(); 
416:	Thread.sleep(10000); 
-
418:	isPlaying = mp.isPlaying(); 
419:	currentPosition = mp.getCurrentPosition(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, reset, setDataSource, start
24:	if (!mediaPlayer.isPlaying() && currentTrack != null) { 
-
27:	mediaPlayer.reset(); 
28:	mediaPlayer.setDataSource(currentTrack); 
29:	mediaPlayer.prepare(); 
-
32:	mediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, setAudioStreamType, setDataSource, setLooping
72:	if(!player.isPlaying()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, reset, stop
90:	if (mMediaPlayer.isPlaying()) { 
-
92:	mMediaPlayer.stop(); 
93:	mMediaPlayer.reset(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, pause, seekTo
100:	if (androidpad!=null) androidpad.seekTo(0); 
-
192:	if (androidpad!=null && androidpad.isPlaying()) { 
193:	androidpad.pause(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
91:	if (mediaPlayer.isPlaying()) { 
92:	mediaPlayer.stop(); 
-
94:	mediaPlayer.release(); 
Full Snippet Info
8
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: getCurrentPosition, getDuration, isPlaying, pause, seekTo
280:	int skipOffset = 10000 + mediaPlayer.getCurrentPosition(); 
281:	int duration = mediaPlayer.getDuration(); 
-
288:	mediaPlayer.seekTo(skipOffset); 
-
294:	int skipOffset = mediaPlayer.getCurrentPosition() - 10000; 
-
301:	mediaPlayer.seekTo(skipOffset); 
-
306:	if (mediaPlayer.isPlaying()) { 
307:	mediaPlayer.pause(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, pause
82:	if (mMediaPlayer.isPlaying()) { 
83:	mMediaPlayer.pause(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
73:	if (mp.isPlaying()) mp.stop(); 
74:	mp.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, reset, stop
200:	if(qiraatPlayer.isPlaying()) 
-
202:	qiraatPlayer.stop(); 
-
204:	qiraatPlayer.reset(); 
205:	qiraatPlayer.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, reset, setDataSource, start
70:	if (mPlayer.isPlaying()) 
71:	mPlayer.stop(); 
72:	mPlayer.reset(); 
-
77:	mPlayer.setDataSource(mFile); 
78:	mPlayer.prepare(); 
79:	mPlayer.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: isPlaying, release, stop
61:	if(player.isPlaying()) 
-
63:	player.stop(); 
-
65:	player.release(); 
Full Snippet Info
8
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, pause
120:	if (mBackgroundMediaPlayer != null && mBackgroundMediaPlayer.isPlaying()){ 
121:	mBackgroundMediaPlayer.pause(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
51:	player.stop(); 
52:	player.release(); 
-
113:	retval = player.isPlaying(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
37:	if (player.isPlaying()) { 
38:	player.stop(); 
-
40:	player.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
44:	if(player.isPlaying()){ 
45:	player.stop(); 
-
47:	player.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, pause
44:	if (mMediaPlayer.isPlaying()) { 
45:	mMediaPlayer.pause(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
38:	if (mediaPlayer.isPlaying()) 
-
40:	mediaPlayer.stop(); 
-
42:	mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
81:	if (mMediaPlayer.isPlaying()) { 
82:	mMediaPlayer.stop(); 
-
84:	mMediaPlayer.release(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
39:	if (mediaPlayer.isPlaying()) { 
40:	mediaPlayer.stop(); 
-
42:	mediaPlayer.release(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
57:	mp.stop(); 
58:	mp.release(); 
-
66:	if (mp.isPlaying()) 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
117:	if (player.isPlaying()) { 
118:	player.stop(); 
-
120:	player.release(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
95:	if (mMediaPlayer.isPlaying()) { 
96:	mMediaPlayer.stop(); 
-
98:	mMediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
77:	if(_mediaPlayer!=null && _mediaPlayer.isPlaying()){ 
-
79:	_mediaPlayer.stop(); 
80:	_mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
217:	if (player.isPlaying()) { 
218:	player.stop(); 
-
220:	player.release(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isPlaying, release, stop
222:	if (this.mediaPlayer.isPlaying()) { 
-
224:	this.mediaPlayer.stop(); 
-
226:	this.mediaPlayer.release(); 
Full Snippet Info
8
CodeRank
Related MediaPlayer isPlaying Questions & Answers:
Other MediaPlayer isPlaying Examples
88:					// check for already playing
89:					if(mp.isPlaying()){
90:						if(mp!=null){
91:							mp.pause();
92:							// Changing button image to play button

Read More

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...
isPlaying Method Overview
Checks whether the MediaPlayer is playing.
See Also
  • isLooping
    Checks whether the MediaPlayer is looping or non-looping.
  • 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.
  • 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.