• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMF can't play media file in a jar file

 
Caven Wang
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JMF to play a sound file(ot.au). My applet works in and out of my JBuilder. When I put all stuff into a jar file, it reports:
javax.media.NoPlayerException: Cannot find a Player for :jar:file:/H:/player.jar!/data/ot.au
my code:
...
try {url=this.getClass().getResource(mediaFile) ;
} catch (Exception mue) { mue.printStackTrace() ; }
...
try {player=Manager.createPlayer( url);
} catch (NoPlayerException e) {
System.out.println(e); }
 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I lately needed *.gif files (pictures for JLabels).
I put it in a jar file too: does not work either.
Solution was: not in the jar but at a (relative) dir
where the jar file lives!
.../your.jar
.../audio/*.*
and then read from audio e.g.
Peter
 
Caven Wang
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Peter
When resource files, such as media or images, are included in a jar file, the applet can run faster. At least the applet can save time to download its multimedia resource. I make it while loading an image from a jar file. Sound is also OK. The big problem is that JMF cann't make it!
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!