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

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

MediaPlayer setDisplay examples from Open Source projects
This code example shows how to use the following methods: setDisplay
159:	mMediaPlayer.setDisplay(holder); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, start
70:	mMediaPlayer = new MediaPlayer(); 
71:	mMediaPlayer.setDataSource(videoPath); 
72:	mMediaPlayer.setDisplay(holder); 
73:	mMediaPlayer.prepare(); 
74:	mMediaPlayer.start(); 
Full Snippet Info
6
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: 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, 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: 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, setDisplay
84:	mediaPlayer.setDisplay(holder); 
-
87:	mediaPlayer.prepare(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setDataSource, setDisplay, setOnCompletionListener, setOnPreparedListener
109:	mediaPlayer.setDisplay(holder); 
110:	mediaPlayer.setDataSource(videoURL); 
111:	mediaPlayer.setOnPreparedListener(new VideoPlayerPrepareListener( 
-
113:	mediaPlayer.setOnCompletionListener(new VideoPlayerOnCompletionListener()); 
114:	mediaPlayer.prepareAsync(); 
Full Snippet Info
6
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, setDataSource, setDisplay, setOnCompletionListener, start
60:	mediaPlayer = new MediaPlayer(); 
61:	mediaPlayer.setOnCompletionListener(this); 
62:	mediaPlayer.setDisplay(holder); 
63:	mediaPlayer.setDataSource(videoPath); 
64:	mediaPlayer.prepare(); 
65:	mediaPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplay
363:	mediaPlayer.setDisplay(mSurfaceHolder); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDuration, prepare, release, setDataSource, setDisplay
141:	MediaPlayer mediaPlayer = new MediaPlayer(); 
-
143:	mediaPlayer.setDataSource(outputFilePath); 
-
145:	mediaPlayer.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder()); 
-
147:	mediaPlayer.prepare(); 
-
149:	mOutputDuration = mediaPlayer.getDuration(); 
-
153:	mediaPlayer.release(); 
-
156:	mediaPlayer.release(); 
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, setDisplay
94:	mediaPlayer.setDisplay(holder); 
-
98:	mediaPlayer.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setDisplay
247:	player.setDisplay(holder); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, setOnCompletionListener, setOnErrorListener
123:	mMediaPlayer = new MediaPlayer(); 
124:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
-
126:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
127:	mMediaPlayer.setOnErrorListener(mErrorListener); 
128:	mMediaPlayer.setDataSource(mContext, mUri); 
129:	mMediaPlayer.setDisplay(mSurfaceHolder); 
130:	mMediaPlayer.setScreenOnWhilePlaying(true); 
131:	mMediaPlayer.prepare(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepareAsync, setDisplay
62:	player.setDisplay(holder); 
63:	player.prepareAsync(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
58:	mMediaPlayer = new MediaPlayer(); 
-
61:	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
6
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, start
58:	mPlayer = new MediaPlayer(); 
59:	mPlayer.setDisplay(mShownSurfaceView.getHolder()); 
-
89:	mPlayer.setDataSource(mfd, 49, Integer.MAX_VALUE 
-
94:	mPlayer.prepare(); 
95:	mPlayer.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
46:	player = new MediaPlayer(); 
47:	player.setDataSource(video); 
48:	player.setDisplay(holder); 
49:	player.prepare(); 
50:	player.setOnBufferingUpdateListener(this); 
51:	player.setOnCompletionListener(this); 
52:	player.setOnPreparedListener(this); 
53:	player.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
44:	mMediaPlayer = new MediaPlayer(); 
-
46:	mMediaPlayer.setDataSource(path); 
-
48:	mMediaPlayer.setDisplay(holder); 
-
50:	mMediaPlayer.prepare(); 
-
52:	mMediaPlayer.setOnBufferingUpdateListener(this); 
53:	mMediaPlayer.setOnCompletionListener(this); 
54:	mMediaPlayer.setOnPreparedListener(this); 
55:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
53:	mMediaPlayer = new MediaPlayer(); 
54:	mMediaPlayer.setDataSource(path); 
55:	mMediaPlayer.setDisplay(holder); 
56:	mMediaPlayer.prepare(); 
57:	mMediaPlayer.setOnBufferingUpdateListener(this); 
58:	mMediaPlayer.setOnCompletionListener(this); 
59:	mMediaPlayer.setOnPreparedListener(this); 
60:	mMediaPlayer.setOnVideoSizeChangedListener(this); 
61:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, start
165:	mPlayer = new MediaPlayer(); 
166:	mPlayer.setDisplay(mShownSurfaceView.getHolder()); 
-
170:	mPlayer.setDataSource(receiver.getFileDescriptor()); 
171:	mPlayer.prepare(); 
172:	mPlayer.start(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay
32:	mediaPlayer.setDisplay(holder); 
33:	mediaPlayer.setDataSource("/sdcard/test2.3gp"); 
34:	mediaPlayer.prepare(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
129:	mMediaPlayer = new MediaPlayer(); 
130:	mMediaPlayer.setDataSource(path); 
131:	mMediaPlayer.setDisplay(holder); 
132:	mMediaPlayer.prepare(); 
133:	mMediaPlayer.setOnBufferingUpdateListener(this); 
134:	mMediaPlayer.setOnCompletionListener(this); 
135:	mMediaPlayer.setOnPreparedListener(this); 
136:	mMediaPlayer.setOnVideoSizeChangedListener(this); 
137:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
78:	this.mediaPlayer = new MediaPlayer(); 
79:	this.mediaPlayer.setDataSource(path); 
80:	this.mediaPlayer.setDisplay(this.surfaceHolder); 
81:	this.mediaPlayer.prepare(); 
82:	this.mediaPlayer.setOnBufferingUpdateListener(this); 
83:	this.mediaPlayer.setOnPreparedListener(this); 
84:	this.mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
86:	mediaPlayer.setOnErrorListener(new OnErrorListener() { 
-
105:	mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setDisplay
29:	player.setDisplay(sh); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDuration, prepare, setAudioStreamType, setDataSource, setDisplay
154:	mMediaPlayer = new MediaPlayer(); 
155:	mMediaPlayer.setDataSource(path); 
156:	mMediaPlayer.setDisplay(holder); 
157:	mMediaPlayer.prepare(); 
158:	mMediaPlayer.setOnBufferingUpdateListener(this); 
159:	mMediaPlayer.setOnCompletionListener(this); 
160:	mMediaPlayer.setOnPreparedListener(this); 
161:	mMediaPlayer.setOnVideoSizeChangedListener(this); 
162:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
163:	mSeekBar.setMax(mMediaPlayer.getDuration()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
56:	mp = new MediaPlayer(); 
-
58:	mp.setDataSource(vedioPath); 
-
60:	mp.setDisplay(sfHolder); 
61:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
65:	mp.prepare(); 
66:	mp.setOnBufferingUpdateListener(mpBufUpdListener); 
67:	mp.setOnCompletionListener(mpCompletListener); 
68:	mp.setOnPreparedListener(mpPrepListener); 
69:	mp.setOnVideoSizeChangedListener(mpVidSizeChgListener); 
70:	mp.start(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
247:	mMediaPlayer = new MediaPlayer(); 
248:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
249:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
253:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
254:	mMediaPlayer.setOnErrorListener(mErrorListener); 
255:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
257:	mMediaPlayer.setDataSource(mContext, mUri); 
258:	mMediaPlayer.setDisplay(mSurfaceHolder); 
259:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
260:	mMediaPlayer.setScreenOnWhilePlaying(true); 
261:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
218:	mMediaPlayer = new MediaPlayer(); 
219:	mMediaPlayer.setOnPreparedListener(mPreparedListener); 
220:	mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); 
-
224:	mMediaPlayer.setOnCompletionListener(mCompletionListener); 
225:	mMediaPlayer.setOnErrorListener(mErrorListener); 
226:	mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); 
-
228:	mMediaPlayer.setDataSource(mContext, mUri); 
229:	mMediaPlayer.setDisplay(mSurfaceHolder); 
230:	mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
231:	mMediaPlayer.setScreenOnWhilePlaying(true); 
232:	mMediaPlayer.prepareAsync(); 
Full Snippet Info
3
CodeRank
This code example shows how to use the following methods: getDuration, prepare, release, setAudioStreamType, setDataSource
257:	mp = new MediaPlayer(); 
258:	mp.setAudioStreamType(AudioManager.STREAM_MUSIC); 
-
260:	mp.setOnErrorListener(this); 
-
262:	mp.setDisplay(mHolder); 
-
265:	mp.setDataSource(path); 
-
271:	mp.prepare(); 
272:	Log.v(TAG, "Duration:  ===>" + mp.getDuration()); 
273:	mp.setOnBufferingUpdateListener(this); 
274:	mp.setOnCompletionListener(this); 
275:	mp.setOnVideoSizeChangedListener(this); 
276:	mp.setOnPreparedListener(this); 
-
289:	mp.stop(); 
290:	mp.release(); 
Full Snippet Info
3
CodeRank
Related MediaPlayer setDisplay Questions & Answers:
setDisplay Method Overview
Sets the SurfaceHolder to use for displaying the video portion of the media.
See Also