Failed to realize
I'm trying to run an application that does simple audio capture, everytime i run it I get a javax.microedition.media.MediaException Failed to Realize. The phone supports audio.capturing (its set to true when I run a app to determine what the phone supports) phone is an LG CU500. Im using AMR to capture audio. Some info on the phone.
MIDP version 2.0
CLDC 1.1
MMAPI version 1.1
supports.recording=true
supports.audio.capturing=true
audio.encoding=<unkown>
protocol capture
audio/
audio/amr
audio/basic
audio/x-wav
audio/wav
[611 byte] By [
aztec30a] at [2007-10-3 4:01:14]

Code sample of what im doing
Thread thrd = new Thread()
{
public void run()
{
try {
int index= listBox.getSelectedIndex();
String enc="";
p= Manager.createPlayer("capture://audio?encoding=amr");
enc = "AMR";
p.realize();
rc = (RecordControl)p.getControl("RecordControl");
output = new ByteArrayOutputStream();
rc.setRecordStream(output);
rc.startRecord();
p.start();
showAlert("Recording","Using the " + enc + " encoding");
} catch (Exception ex) {
showExceptionAlert(ex,null);
ex.printStackTrace();
}
}
};
thrd.start();
Hi,I am getting the same error on LG cu500 ! Did you find solutions ?10x.
Yes, i found a solution to the problem, however now i get a java.lang.securityexception application not authorized to access restricted api
to get rid of the media excpetion you need to specify the encoding when creating the player, like this,
p= Manager.createPlayer("capture://audio?encoding=audio/amr")
know how to get rid of the security exception?
Maybe you need to sign your midlet ;)
I figured out that the methodrc.setRecordStream(output); causes the securityexception to be thrown.
I tried signing the midlet, not sure if i did it correctly.
In NetBeans 5.0 with the mobiliity pack I went to File->Properties->Signing and checked the Sign Distribution using the default Keystore, the certificate details shows its valid, however when I go to install the application I get an error saying certificate expired and the application fails to install. If I don't sign it I can install it, but without signing it looks like i can't access the setRecordStream method.
How else can i sign the app?
have you tried to give that permissionsso that jad file will inlclude it then try to install from jad
I tried adding this to my jad file,
MIDlet-Permissions: javax.microedition.io.Connector.socket,javax.microedition.io.Connector.http
MIDlet-Permissions-Opt: javax.microedition.media.Player,javax.microedition.media.Manage,javax.microedition.media.control.VideoControl.getSnapshot,javax.microedition.media.control.RecordControl
then tried to install from jad file. If I do not sign my midlet i can install it form jad or jar even with the permission above, however if I sign the midlet I can not install it. I get an error saying certificate expired, eventhough I can see in the certificate details displayed in the properties->Signing that it expires a year from now. By the way giving the permission in the jad file does not get rid of the securityexception.
I figured out that the method rc.setRecordStream(output); causes the securityexception to be thrown. Its a restricted method.
Hi,I am getting the same exception when I am creating a video !p= Manager.createPlayer("capture://video")" Exception e4 Failed to realize"Do you find any solution ?10x.
I believe the reason it gives you the failed to realize is because you need to specifiy the encoding. TrycapturePlayer = Manager.createPlayer("capture://video?encoding=video/mp4");let me know how it goes. By the way were you able to get audio recording working?
Hi,
I try your advice but I am still gettting an error :
Cannot create a DataSource for: capture://video?encoding=video/h263
or I try mp4
Cannot create a DataSource for: capture://video?encoding=video/mp4
those any when succssed working with video on lg-cu500(or 400)
10x
> Hi,
>
> I am getting the same exception when I am creating a
> video !
> p= Manager.createPlayer("capture://video")
>
> " Exception e4 Failed to realize"
>
> Do you find any solution ?
>
> 10x.
Hi,
I get this error on my LG CU500 (Cingular) when running a third-party Java application which tries to use the phone's camera: http://semacode.org/
My phone is just as Cingular gave it to me, aside from the edit to the permissions file (via BitPim) that is required to be able to use unsigned applications without getting a popup dialog on every network connection.
Do you know how I can get around this problem?
Thanks!
- Tim
Hi aztec30,
I used Player p = Manager.createPlayer("capture://audio?encoding=audio/amr"); for recording in AMR encoding , then also in Nokia device i m getting runtime exception as java.lang.NullPointerException..
If i write Player p = Manager.createPlayer("capture://audio"); then it works fine on device but i want to record it using AMR encoding .
so please tell me the solution...
Thanks and Regards..
Hi aztec31,
As u suggest, I used Player p = Manager.createPlayer("capture://audio?encoding=audio/amr"); for recording in AMR encoding , then also in Nokia device i m getting runtime exception as java.lang.NullPointerException..
If i write Player p = Manager.createPlayer("capture://audio"); then it works fine on device but i want to record it using AMR encoding .
so please tell me the solution...how to get rid of this java.lang.NullPointerException?
Thanks and Regards..
Hi all,
i m testing the code to record on Nokia 3230 device. first i m displaying the audio encoding formats that it supports.
Nokia 3230 supports "audio/wav,audio/au,audio/amr,audio/raw"
in "audio/wav and audio/au", i was able to record using code..
Player p = Manager.createPlayer("capture://audio?encoding=audio/wav); and
Player p = Manager.createPlayer("capture://audio?encoding=audio/au);
and played it back using code..
Player p2 = Manager.createPlayer (recordedInputStream, "audio/x-wav");
but in "audio/amr and audio/raw", i am not able to record.
for "audio/amr", i tried using..
createPlayer("capture://audio?encoding=audio/amr); but it gives java.lang.NullPointerException in Nokia device.
so for "audio/amr",any change to made in createPlayer while playing..(in code..)
Player p2 = Manager.createPlayer (recordedInputStream, "audio/x-wav");
and for "audio/raw", i tried using..
createPlayer("capture://audio?encoding=audio/raw); but it gives java.lang.IllegalParameterException in Nokia device.
so anyone know how to get rid of these Exceptions?
Thanks and Regards..
hi all,
For createPlayer("capture://audio?encoding=audio/raw");
java.lang.IllegalParameterException is coming in Nokia device and
For createPlayer("capture://audio?encoding=audio/amr"); and i tried
For createPlayer("capture://audio?encoding=amr");
java.lang.NullPointerException is coming in Nokia device.
so anything to change in createPlayer() while Playback the recorded audio?
For "audio/wav and audio/au "(for which it is working fine in Nokia device),
i wrote, Player p2 =
Manager.createPlayer(recordedInputStream,"audio/x-wav");
so please tell me the solution?
Thanks and Regards..
hi all,
For createPlayer("capture://audio?encoding=audio/raw");
java.lang.IllegalParameterException is coming in Nokia device and
For createPlayer("capture://audio?encoding=audio/amr"); and i tried
For createPlayer("capture://audio?encoding=amr");
java.lang.NullPointerException is coming in Nokia device.
so anything to change in createPlayer() while Playback the recorded audio?
For "audio/wav and audio/au "(for which it is working fine in Nokia device),
i wrote, Player p2 = Manager.createPlayer(recordedInputStream,"audio/x-wav");
so please tell me the solution?
Thanks and Regards..