Solved

Jaco Mp3 Player

Posted on 2014-01-25
8
948 Views
Last Modified: 2014-02-04
I'm am trying to use the jaco mp3 player library to play mp3 files.

Please reference site: Jaco Examples
Examples 1 -6 play the sound for second but Example7 plays the all my files.

Can you somebody help me figure this out? I am a complete newbie when it comes to programming and I am trying to learn.

I would like to use the player or windows media player to play url mp3 files from a website.

import jaco.mp3.player.MP3Player;

import java.io.File;

public class Example1 {

  public static void main(String[] args) {
    new MP3Player(new File("test.mp3")).play();
  }

}

Open in new window


The above code played sound for a second on my system.

import jaco.mp3.player.MP3Player;
import jaco.mp3.player.plaf.MP3PlayerUICompact;

import java.io.File;
import java.net.URL;

import javax.swing.BorderFactory;
import javax.swing.JFrame;

public class Example7 {

  public static void main(String[] args) throws Exception {

    // MP3Player.setDefaultUI(MP3PlayerUICompact.class);

    //

    MP3Player player = new MP3Player();

    player.setRepeat(true);

    player.addToPlayList(new File("test.mp3"));
    player.addToPlayList(new File("test2.mp3"));
    player.addToPlayList(new File("test3.mp3"));
    player.addToPlayList(new URL("http://server.com/mp3s/test4.mp3"));

    //

    player.setBorder(BorderFactory.createEmptyBorder(50, 100, 50, 100));

    JFrame frame = new JFrame("MP3 Player");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(player);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }

}

Open in new window


The above code works fine on my pc.
0
Comment
Question by:DOCDGA
  • 4
  • 4
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39809964
Where are all the test mp3 files from?
0
 

Author Comment

by:DOCDGA
ID: 39810829
CEHJ, I'm not sure. I used my personal mp3 files.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39811396
Please attach test.mp3
0
 

Author Comment

by:DOCDGA
ID: 39812143
I can not attach the mp3 file because it is not an acceptable file to upload. This is the message that I receive from the upload tool.

Try this link:
mp3 file

If link does not work, copy and paste into browser: http://sourceforge.net/p/jacomp3player/code/HEAD/tree/JACo%20MP3%20Player%20v3/resources/bosco.mp3
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 86

Expert Comment

by:CEHJ
ID: 39812607
I have the same result. You should ask the author(s)
0
 

Accepted Solution

by:
DOCDGA earned 0 total points
ID: 39813058
CEHJ, I found this during a google search.

https://sites.google.com/site/teachmemrxymon/java/how-to-use-mp3player-class

I'm not sure if this could help me but thought you may wanna look at it.

I don't no to much about threads except they allow you to multitask.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39821085
I tried it on a separate thread. Made no difference for me (silence)
0
 

Author Closing Comment

by:DOCDGA
ID: 39831977
Received some insight from another programmer that the code I found from Mr Xymon allows the music player to operate on its own thread. This makes things easier.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
A short article about problems I had with the new location API and permissions in Marshmallow
This video teaches viewers about errors in exception handling.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now