1 // command line player for MPEG audio file
2 public class MP3Player {
4 private String filename = null;
6 public static void main(String args[]) {
8 MP3Player player = new MP3Player();
13 private void init(String[] args) {
14 if (args.length == 1) {
21 * Playing file from FileInputStream.
23 protected InputStream getInputStream() throws IOException {
24 FileInputStream fin = new FileInputStream(filename);
25 BufferedInputStream bin = new BufferedInputStream(fin);
29 public void play() throws JavaLayerException {
31 System.out.println("playing " + filename + "...");
32 InputStream in = getInputStream();
33 AudioDevice dev = new AudioDevice();
34 Player player = new Player(in, dev);
36 } catch (IOException ex) {
37 throw new JavaLayerException("Problem playing file " + filename, ex);