import javax.media.*;
import java.io.*;

public class MP3Player {

    public static void main(String[] args) throws Exception {
       File file = new File("xyz.mp3");
       MediaLocator mrl = new MediaLocator(file.toURL());
       Player player = Manager.createPlayer(mrl);
       player.start();
    }

}


    }``

when i execute above program, it shows error :
Failed to configure: com.sun.media.PlaybackEngine@ce124a7
Bad header in the media: Couldn't detect stream type
Error: Unable to realize com.sun.media.PlaybackEngine@ce124a7 )
.
Any explaination for the above error ??

is that JMF code?
does look so like me. if it is, dump it. JMF is very outdated and hasn't been maintained for over years. there are better and more efficiënt ways to play mp3 files these days.

also: never allow your main method to throw Exceptions. nothing good can come from it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.