Solved

Jaco Mp3 Player

Posted on 2014-01-25
8
924 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

707 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

14 Experts available now in Live!

Get 1:1 Help Now