Simple Play Mp3 Files In Java

Thursday 23 January 2014


First of all we need to download The Java Media Framework and install on our machine here is the link
Java Media Framework (JMF)  
now import the packages.

 

import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.media.Time;
Now Put that code on button click event
  try
  {               
   MediaLocator ml=new MediaLocator("File address here ex; c:/xyz.mp3”);
   player=Manager.createPlayer(ml);
   player.realize();
   player.start();             
   }
   catch(Exception yxz)
  {
   System.out.println(""+yxz);
   }

0 comments:

Paste Long Url