I'm able to get a sound playing by creating a MediaContainer with its URL constructor but not with its InputStream constructor.

This is true even if I create an InputStream directly from a working URL....
 

This MediaContainer works:
URL resourceURL = ClassLoader.getSystemResource(resourceName);
return new MediaContainer(resourceURL);

This MediaContainer doesn't:
URL resourceURL = ClassLoader.getSystemResource(resourceName);
return new MediaContainer(resourceURL.openStream());

The Exception that is thrown in the second case (when rendering/playing begins) is:
java.lang.NullPointerException
 at javax.media.j3d.SoundScheduler.attachSoundData(SoundScheduler.java:2374)
 at javax.media.j3d.SoundScheduler.calcSchedulingAction(SoundScheduler.java:1286)
 at javax.media.j3d.SoundScheduler.renderChanges(SoundScheduler.java:690)
 at javax.media.j3d.SoundScheduler.processMessages(SoundScheduler.java:211)
 at javax.media.j3d.StructureUpdateThread.doWork(StructureUpdateThread.java:83)
 at javax.media.j3d.J3dThread.run(J3dThread.java:256)

Can anybody shed any light on this situation?
 

Rob Bishop
TASC

Reply via email to