Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK - Let's start by ruling out your MP3 files and your code.</p> <ol> <li>Pick an MP3 file that you have and play it with any MP3 player.</li> <li>Download <a href="http://www.javazoom.net/javalayer/sources/jlayer1.0.1.zip" rel="nofollow noreferrer">http://www.javazoom.net/javalayer/sources/jlayer1.0.1.zip</a></li> <li>Extract jl1.0.1.jar from zip file and put in your classpath</li> <li>Cut and Paste the code at the end of this answer into your dev environment.</li> <li>compile and run making sure your mp3 file in step 1 is the parameter to the file. (In my case I had this "C:\\Users\\romain\\Music\\Al DiMeola\\Elegant Gypsy\\01 Flight over Rio Al DiMeola.mp3")</li> <li><p>I tested this and it works fine.</p> <pre><code>import java.io.BufferedInputStream; import java.io.FileInputStream; import javazoom.jl.player.Player; public class MP3 { private String filename; private Player player; // constructor that takes the name of an MP3 file public MP3(String filename) { this.filename = filename; } public void close() { if (player != null) player.close(); } // play the MP3 file to the sound card public void play() { try { FileInputStream fis = new FileInputStream(filename); BufferedInputStream bis = new BufferedInputStream(fis); player = new Player(bis); } catch (Exception e) { System.out.println("Problem playing file " + filename); System.out.println(e); } // run in new thread to play in background new Thread() { public void run() { try { player.play(); } catch (Exception e) { System.out.println(e); } } }.start(); } // test client public static void main(String[] args) { String filename = args[0]; MP3 mp3 = new MP3(filename); mp3.play(); } </code></pre> <p>}</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload