Solved

Jaco Mp3 Player

Posted on 2014-01-25
8
1,043 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

636 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