Solved

Jaco Mp3 Player

Posted on 2014-01-25
8
980 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Removing line numbers from left column in config file 7 61
CSV file parsing thru Java 13 34
Java basic valueOf question 1 29
hashmap order 17 37
This is an explanation of a simple data model to help parse a JSON feed
This is about my first experience with programming Arduino.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

827 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