Tuesday, 15 March 2011

java - JavaFX play mp3 -



java - JavaFX play mp3 -

when run method, mediaexception. phone call method playsound("src/assets/timeup.mp3");.

private void playsound(string path) { system.out.println(path); media nail = new media(new file(path).touri().tostring()); system.out.println(hit.getsource()); mediaplayer mediaplayer = new mediaplayer(hit); mediaplayer.play(); }

log:

src/assets/timeup.mp3 file:/media/chris/1%20tb%20data/eclipse/workspace/dreggtimer/src/assets/timeup.mp3 exception in thread "main" mediaexception: unknown : com.sun.media.jfxmedia.mediaexception: not create player! : com.sun.media.jfxmedia.mediaexception: not create player! @ javafx.scene.media.mediaexception.exceptiontomediaexception(mediaexception.java:146) @ javafx.scene.media.mediaplayer.init(mediaplayer.java:511) @ javafx.scene.media.mediaplayer.<init>(mediaplayer.java:414) @ timer.timer.playsound(timer.java:53) @ timer.timer.<init>(timer.java:58) @ timer.timer.main(timer.java:39) caused by: com.sun.media.jfxmedia.mediaexception: not create player! @ com.sun.media.jfxmediaimpl.nativemediamanager.getplayer(nativemediamanager.java:222) @ com.sun.media.jfxmedia.mediamanager.getplayer(mediamanager.java:104) @ javafx.scene.media.mediaplayer.init(mediaplayer.java:467) ... 4 more

my project on external drive , linking main drive symlink. running eclipse on main drive. don't believe should cause problems though.

if on linux (which appears stacktrace). need install libavformat53 , libavcodec53 javafx's mediaplayer work, else error.

java javafx mp3

No comments:

Post a Comment