Pergunta

I'm attempting to use the JMF to create background music for my project.

From what I understand, the method Manager.createPlayer(); can use InputStreams, URLs, and DataSources.

However, when I use the following code:

InputStream is = getClass().getResourceAsStream("/03-redial.mp3");
Player aPlayer = Manager.createPlayer(is,"audio/mpeg");
aPlayer.start();

I end up getting this:

"The method createPlayer(URL) in the type Manager is not applicable for the arguments (InputStream, String)"

What did I miss?

Foi útil?

Solução

The javadoc for JMF Manager shows 3 versions of createPlayer; each of them take only one argument (either DataSource, MediaLocator, or URL). None of them take two parameters. If you've seen a two-parameter version of the method, perhaps you are using a different version than the one you saw?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top