Java Media Framework - MP3 Issues -


im using windows 7 , can "java platform se binary" in sound mixer yet still no sound seems play.

my code is:

import javax.media.*; import java.io.file; import java.io.ioexception; import java.net.url; import java.net.malformedurlexc;  public class simpleaudioplayer { private player audioplayer = null;  public simpleaudioplayer(url url) throws ioexception, noplayerexception,      cannotrealizeexception {     audioplayer = manager.createrealizedplayer(url); }  public simpleaudioplayer(file file) throws ioexception, noplayerexception,      cannotrealizeexception {     this(file.tourl()); }  public void play() {     audioplayer.start(); }  public void stop() {     audioplayer.stop();     audioplayer.close(); }  public static void main(string[] args) {     try{         file audiofile = new file("/t.mp3");         simpleaudioplayer player = new simpleaudioplayer(audiofile);          system.out.println();         system.out.println("-> playing file '" +                             audiofile.getabsolutepath() + "'");         system.out.println("   press enter key exit");         player.play();          // wait user press enter proceed.         system.in.read();         system.out.println("-> exiting");         player.stop();     }catch(exception ex){         ex.printstacktrace();     }      system.exit(0);  } } 

i use windows preformance jmf edition. mp3 im trying play works fine in vlc/wmp cant file.

the code throws no exceptions or error when running, doesnt seem play sound.

is there im missing? pulling sound card? e.g. taking on can play sound out of it?

im overall aim to mp3 streaming service using rtp/rtsp links,advice or tuturiols im currelnt using ibm jmf tuturiol , java demo

please ask if more information needed!

update-

downloaded wav file , seemed play, how can make mp3s play?

added formats , tried code , still same issue:

import java.io.file; import javax.media.format; import javax.media.manager; import javax.media.medialocator; import javax.media.player; import javax.media.pluginmanager; import javax.media.format.audioformat;  public class simpleaudioplayer {     public static void main(string[] args) {          format input1 = new audioformat(audioformat.mpeglayer3);         format input2 = new audioformat(audioformat.mpeg);          format output = new audioformat(audioformat.linear);         pluginmanager.addplugin(             "com.sun.media.codec.audio.mp3.javadecoder",             new format[]{input1, input2},             new format[]{output},             pluginmanager.codec         );         try {             player player = manager.createplayer(new medialocator(new file("/t.mp3").touri().tourl()));             player.start();         }         catch(exception ex) {             ex.printstacktrace();         }     } } 

unable handle format: mpeglayer3, 44100.0 hz, 16-bit, stereo, littleendian, signed, 16000.0 frame rate, framesize=32768 bits failed realize: com.sun.media.playbackengine@62deaa2e error: unable realize com.sun.media.playbackengine@62deaa2e

thats error!

as thought, it's missing codec.

i think need: http://www.oracle.com/technetwork/java/javase/download-137625.html


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -