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. Hero 2.1 update

http://androidandme.com/2010/06/phones/htc-manufacturers-news/htc-announces-android-2-1-rollout-for-gsm-hero-on-june-4th/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+androidandme+(Android+and+Me)

Dari tadi nongkroning layar HP... kok notificationnya gak nongol2 juga
yah .... :(

*Anggota pasukan setia menanti* :P

-- 
"Indonesian Android Community [id-android]" 

2. Android Dev Phone with 2.x?

Hello,

I'm owner of ADP1 (1.6 device) but majority of my users have 2.x
version. Does anybody have any idea whether there will be 2.x
developer devices? Currently there is just something like HTC Hero
available that is still IMHO 1.x device.

Also I have one suggestion regarding pricing: Android Device Seeding
program is over but Google could support developers while upgrading
their dev phones according success of their apps (like > 10000
downloads with rating > **** 50% discount, > 250000 downloads with
rating ***** 100% discount etc). I believe that this can be small
support to developers in countries where it is prohibited to sell apps
(which is IMHO majority of the world) and they are doing good job for
Android.

I'm currently providing free apps (as I can't buy and sell on Android
Market from my country) and to buy multiple phones to cover various
flavors of Android is quite expensive hobby ;-)

Have a good day
Tom

-- 

3. OOT: Mirink @Spring Hills

4. antena milestone panas saat interneta

5. A slightly altered pattern for extending the life span of a broadcast receiver (Not entirely verified yet)

6. Multitasking on Android - Why So Incredibly Bad?

7. Changing screens - switching between layouts?