MediaPlayer reset - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer reset method.

This code example shows how to use the following methods: isPlaying, prepare, reset, setDataSource, start
		mediaPlayer = new MediaPlayer();
		isPaused  = false;
	} 
		 
	public void play() { 
    	if (!mediaPlayer.isPlaying() && currentTrack != null) {
    		try { 
    			if (!isPaused) {
    				mediaPlayer.reset();
        			mediaPlayer.setDataSource(currentTrack);
        			mediaPlayer.prepare();
        			isPaused = false;
    			} 
    			mediaPlayer.start();    			
			} catch (Exception e) {
				//ignore 
			}    		 
    	} 
    } 
     
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: pause, release, reset
     * Processes a request to pause the current playback  
     */ 
    protected void processPauseRequest() { 
        if (mState == State.PLAYING) {
            mState = State.PAUSED;
            mPlayer.pause();
            releaseResources(false); // retain media player in pause 
            // TODO polite audio focus, instead of keep it owned; or not? 
        } 
    } 
     
     
    /** 
     * Processes a request to stop the playback. 
     *  
     * @param   force       When 'true', the playback is stopped no matter the value of mState 
     */ 
    protected void processStopRequest(boolean force) {
        if (mState != State.PREPARING || force) {
            mState = State.STOPPED;

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isPlaying, reset, stop
         
        public void stop() { 
            Log.i(TAG, "Call to stop streaming audio");
 
            if (mMediaPlayer != null) {
                if (mMediaPlayer.isPlaying()) {
                    Log.i(TAG, "media player was playing and is now Stopping");
                    mMediaPlayer.stop();
                    mMediaPlayer.reset();
                    mAudioSrvState = NOT_PLAYING;
                } 
            } 
        } 
         
        public String getFileName() {
            return null; 
        } 
 
        public long getPosition() { 
            return 0; 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isPlaying, release, reset, stop
	public static void releasePlayer() 
	{ 
		if(qiraatPlayer != null)
		{ 
			currentAyaPos = 0;
			if(qiraatPlayer.isPlaying())
			{ 
				qiraatPlayer.stop();
			} 
			qiraatPlayer.reset();
			qiraatPlayer.release();		
			//Need to set this to null manually. After calling release(), cannot call any other method on the mediaplayer object. 
			qiraatPlayer = null;
		} 
	} 
	public static boolean isPlaying() { 
		// TODO Auto-generated method stub 
		if(qiraatPlayer != null)
		{ 
			return qiraatPlayer.isPlaying();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: release, reset, stop
		player = new MediaPlayer();
	} 
 
	@Override 
	public void onDestroy() { 
		player.stop();
		player.reset();
		player.release();
		Toast.makeText(this, "Stream Stopped", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onDestroy");
	} 
	 
	@Override 
	public void onStart(Intent intent, int startid) {
		Log.d(TAG, "onStart");
		onBind(intent);
	} 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related MediaPlayer reset Questions & Answers:

Other MediaPlayer reset Examples

235:					}
236:				}
237:			});
238:	
239:			/**

Read More

reset Method Overview
Resets the MediaPlayer to its uninitialized state.
See Code Examples for other Android MediaPlayer Methods: