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

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

MediaPlayer reset examples from Open Source projects
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: pause, release, reset
318:	mPlayer.pause(); 
-
354:	mPlayer.reset(); 
355:	mPlayer.release(); 
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, 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: release, reset, stop
67:	player.stop(); 
68:	player.reset(); 
69:	player.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: 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: pause, release, reset
276:	mPlayer.pause(); 
-
335:	mPlayer.reset(); 
336:	mPlayer.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource, start, stop
38:	player.stop(); 
-
40:	player.reset(); 
-
42:	player.setDataSource(mp3); 
43:	player.prepare(); 
-
45:	player.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentPosition, prepareAsync, reset, setDataSource, stop
289:	player.setDataSource(path); 
-
302:	player.prepareAsync(); 
-
352:	player.stop(); 
-
370:	player.reset(); 
-
412:	res = player.getCurrentPosition(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDuration, prepare, reset
84:	playerPrepare = new MediaPlayer(); 
-
132:	player.reset(); 
133:	sourceProvider.setDataSource(player, filePath); 
134:	player.prepare(); 
135:	duration += player.getDuration(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCurrentPosition, prepare, reset, seekTo, setDataSource
54:	int pos = mp.getCurrentPosition(); 
55:	mp.reset(); 
-
57:	mp.setDataSource(ctx, video); 
58:	mp.prepare(); 
59:	mp.start(); 
-
69:	mp.seekTo(pos); 
Full Snippet Info
7
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, reset, setDataSource, start
51:	mMediaPlayer.reset(); 
-
55:	mMediaPlayer.setDataSource(path); 
56:	mMediaPlayer.prepare(); 
-
62:	mMediaPlayer.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, reset, setAudioStreamType, setDataSource, setLooping
53:	MediaPlayer mp = new MediaPlayer(); 
-
59:	mp.reset(); 
60:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
61:	mp.setLooping(true); 
62:	mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); 
63:	mp.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLooping, isPlaying, prepare, reset, setDataSource
87:	if (mp.isPlaying() || mp.isLooping()) { 
88:	mp.stop(); 
-
90:	mp.reset(); 
-
92:	mp.setDataSource(fis.getFD()); 
93:	mp.prepare(); 
94:	mp.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource, start
26:	mMediaPlayer.reset(); 
27:	mMediaPlayer.setDataSource(song.getUrl()); 
28:	mMediaPlayer.prepare(); 
29:	mMediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource, start
53:	MediaPlayer player = new MediaPlayer(); 
-
55:	player.reset(); 
-
57:	player.setDataSource(jingleFile.getAbsolutePath()); 
58:	player.prepare(); 
59:	player.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, reset, setDataSource, start
48:	if (player.isPlaying()) { 
49:	player.stop(); 
-
51:	player.reset(); 
-
53:	player.setDataSource(f.getFD()); 
54:	player.prepare(); 
55:	player.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying, prepare, reset, setAudioStreamType, setDataSource
141:	if (mediaPlayer.isPlaying()) { 
142:	mediaPlayer.reset(); 
-
144:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
145:	mediaPlayer.setDisplay(holderVideo); 
-
147:	mediaPlayer.setDataSource("/sdcard/video/movie1080.mp4"); 
148:	mediaPlayer.prepare(); 
-
159:	mediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource
60:	m_mediaPlayer.reset(); 
-
62:	m_mediaPlayer.setDataSource(path); 
63:	m_mediaPlayer.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setAudioStreamType, setDataSource, start
106:	mp = new MediaPlayer(); 
-
108:	mp.reset(); 
109:	mp.setDataSource(path); 
110:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
111:	mp.prepare(); 
112:	mp.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, reset, setDataSource, start, stop
88:	player.stop(); 
89:	player.reset(); 
-
92:	player.setDataSource(uri); 
93:	player.prepare(); 
94:	player.start(); 
Full Snippet Info
6
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: getDuration, prepare, reset, setDataSource, setOnBufferingUpdateListener
49:	m_mediaPlayer = new MediaPlayer(); 
50:	m_mediaPlayer.setOnBufferingUpdateListener(this); 
51:	m_mediaPlayer.setOnCompletionListener(this); 
52:	m_mediaPlayer.reset(); 
-
54:	m_mediaPlayer.setDataSource(path); 
-
63:	m_mediaPlayer.prepare(); 
-
69:	return m_mediaPlayer.getDuration(); 
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: 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: getDuration, prepare, reset, setDataSource, setOnBufferingUpdateListener
49:	m_mediaPlayer = new MediaPlayer(); 
50:	m_mediaPlayer.setOnBufferingUpdateListener(this); 
51:	m_mediaPlayer.setOnCompletionListener(this); 
52:	m_mediaPlayer.reset(); 
-
54:	m_mediaPlayer.setDataSource(path); 
-
63:	m_mediaPlayer.prepare(); 
-
69:	return m_mediaPlayer.getDuration(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLooping, prepare, release, reset, setDataSource
673:	mp = new MediaPlayer(); 
674:	mp.setDataSource(filePath); 
675:	mp.prepare(); 
-
677:	mp.setLooping(true); 
678:	mp.reset(); 
679:	if (mp.isLooping()) { 
-
688:	mp.release(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getVideoHeight, getVideoWidth, prepare, reset, setAudioStreamType
33:	mediaPlayer = new MediaPlayer(); 
34:	mediaPlayer.setOnBufferingUpdateListener(this); 
35:	mediaPlayer.setOnPreparedListener(this); 
36:	mediaPlayer.setOnCompletionListener(this); 
37:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
45:	mediaPlayer.reset(); 
46:	mediaPlayer.setDataSource("/sdcard/dhlj/SimplifiedChineseRes/res/Video/480_0.mp4"); 
47:	mediaPlayer.prepare(); 
-
49:	videoWidth = mediaPlayer.getVideoWidth(); 
50:	videoHeight = mediaPlayer.getVideoHeight(); 
-
67:	mediaPlayer.start(); 
Full Snippet Info
4
CodeRank
Related MediaPlayer reset Questions & Answers:
Other MediaPlayer reset Examples
235:					}
236:				}
237:			});
238:	
239:			/**

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...
reset Method Overview
Resets the MediaPlayer to its uninitialized state.
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.
  • 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.