views:

245

answers:

1

Hi,

I have an application that processes data from bluetooth and send it to the web service. Recently there was a request to add sounds to the application. Now when the application processes batches of data and the player is playing constantly after a few secs I get "Application is not responding" exception. And then the process is terminated. In the logs I can see lots of ForcedStackTrace exception logged after this exception. The sounds are played in the separate thread. If app doesn't play sounds or plays short sounds - everything works fine. Is there any way to avoid this exception happening? Why is it happening?

 InputStream mediaStream = null;
 try {
  mediaStream = getClass().getResourceAsStream(relativePath);
  getLogger().log("setting player _ " + _audioType);
  setPlayer(Manager.createPlayer(mediaStream, _audioType));
  _currentPlayer.addPlayerListener(this);
  _currentPlayer.setLoopCount(1);
  _currentPlayer.realize();
  VolumeControl vc = (VolumeControl) _currentPlayer
    .getControl("VolumeControl");
  if (vc != null) {
   vc.setLevel(_voumeLevel);
  }
  _currentPlayer.prefetch();
  _currentPlayer.start();
 } catch (Exception e) {
 }

Thanks in advance, Viktor.

//crossposted from BB forums

+1  A: 

Resolved by implementing my own PlayerManager, which, running in a separate thread would play the item in the queue manner rather then having many threads using the inner Player implementation.

Revenge