Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java Micro Edition and the fly likes Bug Player on Nokia Handset  serie 60 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Bug Player on Nokia Handset  serie 60" Watch "Bug Player on Nokia Handset  serie 60" New topic
Author

Bug Player on Nokia Handset serie 60

Ould Nadif
Ranch Hand

Joined: Jan 21, 2004
Posts: 184
After playing 15 times there is bug:I tHink it is a problem of memory.
Before playing any new playing I call the stop function.

Here is my function that implements the player:

void playMusicBuffer(byte[] data) {

if((!bStartMedia) && (player==null)){

try {

//Jouer le buffer
ByteArrayInputStream isb = new ByteArrayInputStream(
data);
player = Manager.createPlayer(isb, "audio/mpeg");
player.addPlayerListener(this);
player.realize();
player. prefetch();
vc=null;
vc = getVolumeControl();
vc.setLevel(indiceVolume*20);
player.setLoopCount(-1);
player.start();
data = null;
Buffer = null;
bCancel = false;
System.gc();
Runtime runtime = Runtime.getRuntime();
totalMem = runtime.totalMemory();
memBefore = runtime.freeMemory();

}
catch (Exception ioe) {
ioe.printStackTrace();
System.out.println("playMusicBuffer Pb avec avec le flux entrant :");
}

}

}

Here is the function that implements the stop function:

void stopMusic() {

try {
if (player != null) {
player.stop();
player.close();
player = null;
bStartMedia = false;
} }
catch (IllegalStateException e) {
e.printStackTrace();
}
catch (Exception ioe) {
ioe.printStackTrace();
}


}


I don't understand why there is that bug. I made tests on Nokia 6680.


OULD NADIF


We are ones that build the world, thus build it well.
Ramender Mall
Ranch Hand

Joined: Sep 08, 2005
Posts: 311
AND what is the bug??


- Ramy..
Ould Nadif
Ranch Hand

Joined: Jan 21, 2004
Posts: 184
Hi,

The bug is that the player can't play any song after 15 times of playing.

OULD NADIF
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bug Player on Nokia Handset serie 60