Erro ao executar áudio

0 respostas
V

Caros,

Tenho a seguinte classe:

package br.com.x.www.chess;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;

public class Audio {
	
	public InputStream startGameAudioFile;
	
	public Player startGameAudio;
	
	public Audio() {
		
		startGameAudioFile = getClass().getResourceAsStream("audio/start.mid");
		
		try {
			startGameAudio = Manager.createPlayer(startGameAudioFile, "audio/mid");
			startGameAudio.realize();
			startGameAudio.prefetch();
			
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (MediaException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
	}
	
	public void startGameAudio() {
		try {
			startGameAudio.start();
		} catch (MediaException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void stopGameAudio() {
		try {
			startGameAudio.stop();
		} catch (MediaException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

E em outra classe eu chamo:

audio.startGameAudio();

e dá o seguinte erro:

Running with storage root DefaultColorPhone

nickNameRecord: 1

gameKeyRecord: 2

startApp threw an Exception

java.lang.IllegalArgumentException

java.lang.IllegalArgumentException

at javax.microedition.media.Manager.createPlayer(+11)

at br.com.cpqd.www.chess.Audio.(+131)

at br.com.cpqd.www.chess.RootEngine.(+93)

at br.com.cpqd.www.chess.Browser.go(+49)

at br.com.cpqd.www.chess.Browser.startApp(+36)

at javax.microedition.midlet.MIDletProxy.startApp(+7)

at com.sun.midp.midlet.Scheduler.schedule(+270)

at com.sun.midp.main.Main.runLocalClass(+28)

at com.sun.midp.main.Main.main(+116)

Execution completed.

722072 bytecodes executed

7 thread switches

761 classes in the system (including system classes)

4723 dynamic objects allocated (139744 bytes)

9 garbage collections (111484 bytes collected)
Criado 15 de novembro de 2006
Respostas 0
Participantes 1