fail to prepare with MediaRecorder

by awwa » Thu, 30 Sep 2010 15:09:52 GMT


Sponsored Links
 ello,

I have a problem with MediaRecorder. I want to record video. But fail
to prepare the MediaRecorder.
Here is the logs and source code. Is there anything wrong?

In the logs, [Failed to get camera(0x32e58) parameters].
I think that this is due to.
Why failed to get camera parameters?
Also, what should I do?

- Environment
-- Dev phone 1
-- OS 1.6

Thank you.

---- source code ----
private boolean initializeRecorder() {
Log.i(TAG, "initializeRecorder");
try {
releaseMediaRecorder();
mRecorder = new MediaRecorder();
mRecorder.setCamera(mCameraDevice);
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setMaxDuration(30000);
mRecorder.setOutputFile("/sdcard/sample.3gp");
mRecorder.setVideoFrameRate(10);
mRecorder.setVideoSize(176, 144);
mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
mRecorder.setMaxFileSize(50000000);
mRecorder.prepare(); // <-
occur exception
Log.i(TAG, "initializeRecorder prepared"); // <- not called
return true;
} catch (IllegalStateException e) {
releaseMediaRecorder();
e.printStackTrace();
} catch (IOException e) {
releaseMediaRecorder();
e.printStackTrace();
}
return false;
}
--------

---- logs ----

I/ActivityManager(72): Starting activity: Intent
{ cmp=com.wataru.test15/.RecordVideoActivity }
D/test15(1698): test15 onPause()
I/RecordVideoActivity(1698): startPreview
D/CameraService(51): CameraService::connect E (pid 1698, client
0x1c3f8)
D/CameraService(51): Client::Client E (pid 1698)
D/QualcommCameraHardware(51): createInstance: E
D/QualcommCameraHardware(51): createInstance: X created
hardware=0x20068
D/CameraService(51): Client::Client X (pid 1698)
D/CameraService(51): CameraService::connect X
D/CameraService(51): getParameters(antibanding=off;antibanding-
values=off;effect=none;effect-
values=none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua;jpeg-
quality=100;jpeg-thumbnail-height=384;jpeg-thumbnail-quality=90;jpeg-
thumbnail-width=512;picture-format=jpeg;picture-size=2048x1536;picture-
size-values=2048x1536,1600x1200,1024x768;preview-
format=yuv420sp;preview-frame-rate=15;preview-
size=480x320;whitebalance=auto;whitebalance-
values=auto,incandescent,florescent,daylight,cloudy,twilight,shade)
D/CameraService(51): setParameters(jpeg-thumbnail-
width=512;antibanding-values=off;preview-frame-rate=15;preview-
size=176x144;picture-format=jpeg;antibanding=off;jpeg-thumbnail-
height=384;picture-size=2048x1536;effect=none;whitebalance=auto;jpeg-
thumbnail-quality=90;jpeg-quality=100;whitebalance-
values=auto,incandescent,florescent,daylight,cloudy,twilight,shade;preview-
format=yuv420sp;effect-
values=none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua;picture-
size-values=2048x1536,1600x1200,1024x768)
D/Camera(1698): app passed NULL surface
D/CameraService(51): setPreviewDisplay(0x0) (pid 1698)
D/CameraService(51): startPreview (pid 1698)
D/CameraServic



Other Threads

1. Can we access windows partition through android?

Hi,

I want to run some batch scripts to on windows box but my project is
android project hence it acess its shell if I use exec but is there
anyway I can able to access the windows partition?

Best Regards,

Amit Dixit

-- 

2. Posting Toast From Worker Thread to UI Thread

Hi
I was trying to post a toast notification in case something goes wrong
in a worker thread.
I do this by putting a handler.post(funcFailed) in the catch block
where funcFailed it a runnable and simply called a function
funcFailedshow()

funcFailedshow() is defined to be Toast.makeText(App.this,"Error in
funcfailed", Toast.LENGTH_LONG).show();

For some reason i cannot see the toast notification. Even if i replace
App.this (app is the applications name) with a getApplicationContext()
it does not work.

Could someone please help me with this.

Thanks

-- 

3. androidconnector and androidpublisher

4. Unable to create an android project

5. Why I'm not getting the "select package" field when I open a new Android Project?

6. screen design

7. accept me