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

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

MediaPlayer setScreenOnWhilePlaying examples from Open Source projects
This code example shows how to use the following methods: prepare, setAudioStreamType, setDataSource, setScreenOnWhilePlaying
	private FileHelper fileHelper;
 
	//////// ********* Constructor ********* ////////// 
	public AudioPlay(String id, Context _context,Boolean isFav) {
		mContext = _context;
		mPlayer = new MediaPlayer();
		fileHelper = new FileHelper();
		if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
			mPath = getFile(isFav,id);
			mPlayer.setScreenOnWhilePlaying(true);
			mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
			try { 
				mPlayer.setDataSource(mPath.toString());
				mPlayer.prepare();
			} catch (IllegalStateException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} 
		} else { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: prepare, setDataSource, setDisplay, setOnCompletionListener, setOnErrorListener
This code example shows how to use the following methods: setDisplay, setOnBufferingUpdateListener, setOnCompletionListener, setOnErrorListener, setOnInfoListener
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
3
CodeRank
This code example shows how to use the following methods: prepareAsync, setAudioStreamType, setDataSource, setDisplay, setOnBufferingUpdateListener
3
CodeRank
Related MediaPlayer setScreenOnWhilePlaying Questions & Answers:
setScreenOnWhilePlaying Method Overview
Control whether we should use the attached SurfaceHolder to keep the screen on while video playback is occurring.
See Code Examples for other Android MediaPlayer Methods: