I'm trying to write a simple media playback application in J2ME. Currently I'm starting with the most simple thing, I just want to play a wav file from resources included in the jar file. I'm using this simple code:
DataInputStream wav = new DataInputStream(getClass().getResourceAsStream("sample.wav"));
Player player = Manager.createPlayer(wav, "audio/x-wav");
player.addPlayerListener(this);
player.realize();
VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");
if( vc != null )
vc.setLevel(100);
player.start();
I run it on two phones: Nokia E65 with latest firmware and Nokia 3110c with original firmware. On E65 I see that the player is created, it starts playing and there are no exceptions thrown. But I can hear nothing... The same wav file works fine with built in media player.
As you see I have a player listener attached and it only receives single message: STARTED
. (There is no VOLUME_CHANGED
or END_OF_MEDIA
event.)
The same jar file running on Nokia 3110c plays fine and shows all expected player events.
Any idea what may be wrong with the E65 or what I'm doing wrong?
Bomber is a j2me MIDP 2.0 game based on a Spectrum 48k classic original game. It was developed using Sun Java Wireless Toolkit and is tested on Nokia 6234 mobile phone. Falling blocks game clone, designed for J2ME devices with 176x208 resolution or greater, programmed with Nokia 6630, but should run on any MIDP 2.0 devices.
Remake in j2me of old snake game of nokia mobile phones. Bomber is a j2me MIDP 2.0 game based on a Spectrum 48k classic original game. It was developed using Sun Java Wireless Toolkit and is tested on Nokia 6234 mobile phone.
This MIDlet can work with Nokia mobile phones seriess 40 MIDP 1.0 (ex. 3220, 3230, 6100, 6610/6610i, 7250 etc.) or MIDP 2.0 (ex. 6230/6230i etc.).
I've found solution at Nokia forums: Does J2ME Media Player on Nokia E65 work?
Warning Tones must be enabled in user's profile.
Make sure you have "warning sounds" switched on in the current profile...
...check the manual for the device. On the N96, it's in Tools, Profiles, (select profile), Options, Personalise, Warning Tones.
There's no way to check this setting from the j2me application code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With