package com.example.interface01;



import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.widget.SeekBar;
import android.widget.TextView;

import java.io.IOException;
import java.util.concurrent.TimeUnit;


import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;

public class player extends Activity {
	
	
	
	private MediaPlayer mediaPlayer;
	public TextView songName, duration;
	private double timeElapsed = 0, finalTime = 0;
	private int forwardTime = 2000, backwardTime = 2000;
	private Handler durationHandler = new Handler();
	private SeekBar seekbar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		//set the layout of the Activity
		setContentView(R.layout.player);

		//initialize views
		initializeViews();
	}

	
	public void initializeViews(){
		songName = (TextView) findViewById(R.id.songName);
		
	
		//mediaPlayer = MediaPlayer.create(this, R.raw.sample_song);
	//	finalTime = mediaPlayer.getDuration();
	//	duration = (TextView) findViewById(R.id.songDuration);
	//	seekbar = (SeekBar) findViewById(R.id.seekBar);
		songName.setText("Sample_Song.mp3");
		
		MediaPlayer mediaPlayer = new MediaPlayer(); 
		
		//String file = "http://www.analog-design.net/ALARME/Videos/enigma.mp3";
		try {
			mediaPlayer.setDataSource("http://www.analog-design.net/ALARME/Videos/enigma.mp3");
			mediaPlayer.prepare(); 
			mediaPlayer.start(); 
			
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		
		//mediaPlayer.setDataSource(file); 
	
		
		//seekbar.setMax((int) finalTime);
		//seekbar.setClickable(false);
		
	}
	
	

		


	
	
		
}

