Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bug Player on Nokia Handset serie 60

 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ramender Mall
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AND what is the bug??


- Ramy..
 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

OULD NADIF
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!