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

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

MediaPlayer setAudioStreamType examples from Open Source projects
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: prepare, setAudioStreamType, setDataSource
39:	mp = new MediaPlayer(); 
40:	mp.setDataSource( afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); 
41:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
42:	mp.prepare(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setAudioStreamType
50:	mediaPlayer = new MediaPlayer(); 
51:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
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, prepare, setAudioStreamType, setDataSource, setLooping
72:	if(!player.isPlaying()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource
39:	mp = new MediaPlayer(); 
40:	mp.setDataSource( afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); 
41:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
42:	mp.prepare(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setOnCompletionListener, start
57:	MediaPlayer mediaPlayer = new MediaPlayer(); 
-
59:	mediaPlayer.setDataSource(context, 
-
70:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); 
-
72:	mediaPlayer.prepare(); 
-
78:	mediaPlayer.start(); 
79:	mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setDataSource, setLooping, setOnErrorListener
61:	MediaPlayer newPlayer = new MediaPlayer(); 
-
64:	newPlayer.setOnErrorListener(playerErrorListener); 
65:	newPlayer.setDataSource(context, ringtoneUri); 
66:	newPlayer.setLooping(true); 
67:	newPlayer.setAudioStreamType(AudioManager.STREAM_RING); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
22:	mMediaPlayer = new MediaPlayer(); 
23:	mMediaPlayer.setOnBufferingUpdateListener(this); 
24:	mMediaPlayer.setOnCompletionListener(this); 
25:	mMediaPlayer.setOnPreparedListener(this); 
26:	mMediaPlayer.setOnErrorListener(this); 
27:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setLooping, start
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
This code example shows how to use the following methods: setAudioStreamType
45:	MediaPlayer player = new MediaPlayer(); 
46:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
8
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: 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: 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: prepare, setAudioStreamType, setDataSource, start
45:	mMediaPlayer.setDataSource(videoPath); 
46:	mMediaPlayer.prepare(); 
-
54:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
55:	mMediaPlayer.start(); 
Full Snippet Info
7
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: 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: setAudioStreamType
49:	player = new MediaPlayer(); 
50:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setLooping, setOnCompletionListener
22:	MediaPlayer mp = new MediaPlayer(); 
-
26:	mp.setDataSource(context, alert); 
27:	mp.setLooping(false); 
28:	mp.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); 
29:	mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
-
36:	mp.prepare(); 
37:	mp.start(); 
Full Snippet Info
7
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: prepare, setAudioStreamType, setDataSource, start
147:	mPlayer = new MediaPlayer(); 
148:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
149:	mPlayer.setDataSource(mFD); 
150:	mPlayer.prepare(); // might take long! (for buffering, etc) 
151:	mPlayer.start(); 
Full Snippet Info
7
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: prepare, setAudioStreamType, setDataSource, setLooping, start
47:	mediaPlayer.setDataSource(context, mRingUri); 
-
50:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
51:	mediaPlayer.setLooping(true); 
52:	mediaPlayer.prepare(); 
53:	mediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, start
45:	mMediaPlayer = new MediaPlayer(); 
-
47:	mMediaPlayer.setDataSource(context, alert); 
-
51:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
52:	mMediaPlayer.prepare(); 
53:	mMediaPlayer.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
65:	mMediaPlayer = new MediaPlayer(); 
66:	mMediaPlayer.setDataSource(path); 
-
68:	mMediaPlayer.setDisplay(holder); 
69:	mMediaPlayer.prepare(); 
70:	mMediaPlayer.setOnBufferingUpdateListener(this); 
71:	mMediaPlayer.setOnCompletionListener(this); 
72:	mMediaPlayer.setOnPreparedListener(this); 
73:	mMediaPlayer.setOnVideoSizeChangedListener(this); 
74:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnCompletionListener, setOnErrorListener, start
93:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
94:	mMediaPlayer.setOnCompletionListener(new OnCompletionListener() { 
-
99:	mMediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
107:	mMediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setLooping, start
22:	mediaPlayer = new MediaPlayer(); 
-
25:	mediaPlayer.setDataSource(MyApp.getContext(), 
-
41:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); 
42:	mediaPlayer.setLooping(true); 
-
44:	mediaPlayer.prepare(); 
-
52:	mediaPlayer.start(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
39:	mMediaPlayer = new MediaPlayer(); 
40:	mMediaPlayer.setDataSource(path); 
41:	mMediaPlayer.setDisplay(holder); 
42:	mMediaPlayer.prepare(); 
43:	mMediaPlayer.setOnBufferingUpdateListener(this); 
44:	mMediaPlayer.setOnCompletionListener(this); 
45:	mMediaPlayer.setOnPreparedListener(this); 
46:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setLooping, start
196:	mediaPlayer = new MediaPlayer(); 
197:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
-
199:	mediaPlayer.setDataSource(this, uri); 
200:	mediaPlayer.setLooping(false); 
201:	mediaPlayer.prepare(); 
202:	mediaPlayer.start(); 
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: prepare, setAudioStreamType, setDataSource, setLooping, start
47:	mediaPlayer.setDataSource(context, mRingUri); 
-
50:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
51:	mediaPlayer.setLooping(true); 
52:	mediaPlayer.prepare(); 
53:	mediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setLooping, start
39:	mMediaPlayer = new MediaPlayer(); 
40:	mMediaPlayer.setDataSource(context, alert); 
-
43:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
44:	mMediaPlayer.setLooping(false); 
45:	mMediaPlayer.prepare(); 
46:	mMediaPlayer.start(); 
-
48:	mMediaPlayer.stop(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setScreenOnWhilePlaying
28:	mPlayer = new MediaPlayer(); 
-
32:	mPlayer.setScreenOnWhilePlaying(true); 
33:	mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
35:	mPlayer.setDataSource(mPath.toString()); 
36:	mPlayer.prepare(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnVideoSizeChangedListener
142:	mMediaPlayer = new MediaPlayer(); 
143:	mMediaPlayer.setOnVideoSizeChangedListener(mVideoSizeListener); 
144:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_RING); // Use ringer volume 
145:	mMediaPlayer.setDataSource(getActivity(), videoSource); 
146:	mMediaPlayer.setDisplay(mVideoPreview.getHolder()); 
147:	mMediaPlayer.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: 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: 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: 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: prepare, release, setAudioStreamType, setDataSource, setLooping
32:	alarmPlayer = new MediaPlayer(); 
33:	alarmPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); 
-
35:	alarmPlayer.setDataSource(context, alarmUri); 
36:	alarmPlayer.setLooping(true); 
37:	alarmPlayer.prepare(); 
-
40:	alarmPlayer.release(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAudioStreamType, setOnCompletionListener, setOnErrorListener, start
91:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
92:	mMediaPlayer.setOnCompletionListener(new OnCompletionListener() { 
-
97:	mMediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
105:	mMediaPlayer.start(); 
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: prepare, setAudioStreamType, setDataSource, setDisplay, start
34:	mediaPlayer = new MediaPlayer(); 
35:	mediaPlayer.setDisplay(holder); 
-
37:	mediaPlayer.setDataSource(videoPath); 
38:	mediaPlayer.prepare(); 
-
42:	mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
43:	mediaPlayer.start(); 
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, 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, 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: 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
Related MediaPlayer setAudioStreamType Questions & Answers:
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...
setAudioStreamType Method Overview
Sets the audio stream type for this MediaPlayer.
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.
  • 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.