Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JMF - javax.media.NoPlayerException

404 views
Skip to first unread message

James S. Kang

unread,
Feb 17, 1998, 3:00:00 AM2/17/98
to

I just got the Java Media Framework and tried to use it to make a simple bean
that just plays a hardwired .wav file. Unfortunately, I always get a
"NoPlayerException" whenever I drop it into the BeanBox (the constructor is
called).

Here's the code (please tell me if there's anything obviously wrong with it):

package mine.test;

import javax.media.*;
import java.net.URL;

public class PlayerTest {
Player player = null;
Class myClass = getClass();

public PlayerTest() {
try {
URL mediaURL = myClass.getResource("stupid.wav");
player = Manager.createPlayer(mediaURL);
}
catch(Exception e) {
System.err.println("Exception: " + e);
}
}

public void play() {
if (player != null)
player.start();
}
}

The .wav file is included in the jar.

From some brief online documentation, I understand that NoPlayerException is
thrown when the PlayerFactory can't find a Player for the particular resource
given to the Player's constructor. So, I tried putting .au and .midi files in
the .wav file's place in the code and in the jar, and the same thing happened.

Just one more question: why is DirectX required for JMF? Does this make JMF
non-cross platform, or is DirectX only used for .avis or something?

If anyone can tell me what I'm doing wrong, I'd greatly appreciate it. And if
you email me, don't forget to remove the !!s.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

"It's fucked to hear one idiot's words
but worse to see others believe it."

--Entombed

http://www.cs.nwu.edu/~chaos

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Sean C Sullivan

unread,
Feb 17, 1998, 3:00:00 AM2/17/98
to

In article <6cbf7n$g...@news.acns.nwu.edu>,

James S. Kang <!!jk...@nwu.edu!!> wrote:
>I just got the Java Media Framework and tried to use it to make a
>simple bean that just plays a hardwired .wav file.

FYI, you may want to look at Intel's SimpleVideo bean:

http://developer.intel.com/ial/jmedia/Gallery.htm

>Unfortunately,
>I always get a "NoPlayerException" whenever I drop it into the
>BeanBox (the constructor is called).
>
>Here's the code (please tell me if there's anything obviously wrong
>with it):
>
>package mine.test;
>
>import javax.media.*;
>import java.net.URL;
>
>public class PlayerTest {
> Player player = null;
> Class myClass = getClass();
>
> public PlayerTest() {
> try {
> URL mediaURL = myClass.getResource("stupid.wav");
> player = Manager.createPlayer(mediaURL);
> }
> catch(Exception e) {
> System.err.println("Exception: " + e);
> }
> }
>
> public void play() {
> if (player != null)
> player.start();
> }
>}
>
>The .wav file is included in the jar.

In order for this to work, your WAV file and class file
must be in the same subdirectory in the JAR.

Your JAR should look something like this:
mine/test/PlayerTest.class
mine/test/stupid.wav

Are you using Sun's JMF or Intel's JMF?

Sun's JMF is still in beta. Intel has a final
release available at http://developer.intel.com/ial/jmedia/

> [...]


>Just one more question: why is DirectX required for JMF? Does this make
>JMF non-cross platform, or is DirectX only used for .avis or
>something?

JMF is simply an API. It can be implemented in pure Java or
natively.

Sun is providing implementations of JMF for Win32 and Solaris.
Intel is providing an implementation of JMF for Win32.

Intel's implementation uses native code to get the best
possible performance. With Intel's JMF, all media rendering
is done natively by Microsoft DirectShow.

Philosophically, the javax.media package is not that much different
from the java.awt package. Both packages are implemented
natively on multiple platforms.


-Sean
disclaimer: I work for Intel but I don't speak for Intel
--
Any escape might help to smooth the unattractive truth
But the suburbs have no charms to soothe
The restless dreams of youth. (Rush, "Subdivisions")

0 new messages