Code example for MediaPlayer: Playing audio and video

Methods: setLoopingstart

0
	} 
 
	// plays the song once 
	public void play() { 
		if (_state == IDLE || _state == PAUSED) {
			_mediaPlayer.start();
			_state = PLAYING;
 
			_startTime = System.currentTimeMillis();
		} 
	} 
 
	// loops the song infinitely 
	public void loop() { 
		if (_state == IDLE || _state == PAUSED) {
			_mediaPlayer.setLooping(true);
			play(); 
		} 
	} 
	 
	public int getSongLength() { 
Experience pair programming with AI  Get Codota for Java