views:

369

answers:

2

I get a MediaException (Prefetch error: -5) when executing the following code on a Nokia N73. It runs fine in the emulator and I have tried the same thing before on the same phone successfully. The only difference now is that I am using NetBeans to build and deploy rather than Eclipse.

inputPlayer = Manager.createPlayer("capture://audio?encoding=pcm&rate=4000&bits=16&channels=1");
inputPlayer.realize();
inputPlayer.prefetch();
inputPlayer.start();

I am wondering whether it is security related, as with Eclipse I always got a security prompt on the phone. With NetBeans I do not get any prompt, just the Exception.

+1  A: 

Make sure that you do not have any other player references held. That is, you are not attempting to prefetch the second player object, while the first one is not yet released/closed. Also, esp on the Nokia, try releasing it on a separate thread, as closing/releasing the player on the same thread is know to cause some problems. Same with creating too.

Ram
I found a workaround: Calling createplayer with "capture://audio" only works fine...
Ries
+1  A: 

-5 is Symbian error code KErrNotSupported.

The N73 is based on Symbian OS v9.1

Native (from Symbian C++) error codes are sometimes propagated into Java exceptions when the JSR-135 implementation couldn't find a nicer way to express the error.

QuickRecipesOnSymbianOS