when i am running this code nothing get's played. But there is no error. I am using the cross platform JMF 2.1.1 and have imported JMF.jar file in my netbeans project.
import javax.swing.*;
import java.awt.*;
import javax.media.*;
import java.awt.event.*;
import java.net.*;
public class HelloJMF {
JFrame frame = new JFrame(" Hello JMF Player");
static Player helloJMFPlayer = null;
public HelloJMF() {
try { // method using URL
URL url = new URL("file", null, "C:\\Users\\Tamojit9\\Documents\\NetBeansProjects\\MediaPlayer\\src\\sample\\gunaah.mp3");
helloJMFPlayer = Manager.createRealizedPlayer(url);
} catch (Exception e) {
System.out.println(" Unable to create the audioPlayer :" + e);
}
Component control = helloJMFPlayer.getControlPanelComponent();
frame.getContentPane().add(control, BorderLayout.CENTER);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
HelloJMF.stop();
System.exit(0);
}
});
frame.pack();
frame.setSize(new Dimension(200, 50));
frame.setVisible(true);
helloJMFPlayer.start();
}
public static void stop() {
helloJMFPlayer.stop();
helloJMFPlayer.close();
}
public static void main(String args[]) {
HelloJMF helloJMF = new HelloJMF();
}
}
Please help me in finding the error!!!!