package gie;
// pour faire du bruit
import java.io.*;

public class Media  {
  protected String fileName="";
  protected String cmd[]=new String[2];

  public Media(String file){
    fileName=file;
    cmd[0]="xplay";
  }

  public synchronized void play(){
    try {
      File f = new File(fileName);
      if (!f.canRead()) 
	throw new IllegalArgumentException("no File:"+fileName);
      
      Runtime r=Runtime.getRuntime();
      cmd[1]=fileName;
      //System.out.println(">>> "+cmd[0]+" "+cmd[1]);
      r.exec(cmd);
    } catch (Exception e) {System.out.println(e);}

  }

  public static void main(String args[]){
    if(args!=null)
      new Media(args[0]).play();
  }
}
