Balban
Balban

Reputation: 736

Android MediaRecorder release() issue and Video capturing is not in portrait mode

I am facing some issue while developing Video capturing application.

1) When I start capturing the Video, the surface view comes in landscape mode. I tried a lot. But i failed. I also referred
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRotation%28int%29 .. but no result

2) I am using release() method. but when we use that, after capturing application get closed. if I donot use this in memory card there is a video with no any capture and zero size.

Can any body explain why it is happening so?

Thanks in Advance

Upvotes: 4

Views: 2001

Answers (4)

tomelf
tomelf

Reputation: 53

I would like to answer only the question 1. I've stuck with this problem before, too. I found that you can use the function setOrientationHint (API 9). Call this function before you call MediaRecorder.prepare(). You can setup the orientation degree for your output video.

Hope it helps, good luck!

Upvotes: 0

Chad Schultz
Chad Schultz

Reputation: 7860

I spent hours on a similar problem. Anytime I released the MediaRecorder and then pressed the back button, the app would close and restart--onPause, onStop, onDestroy wouldn't fire in the Activity I was leaving, it would just be dead and then onCreate would fire in the Application.

After a lot of experimentation, I discovered the problem went away if I added

mediaRecorder = null;

immediately after calling mediaRecorder.release();

Upvotes: 2

Samir Mangroliya
Samir Mangroliya

Reputation: 40426

I have same issue for thread create problem and i stop first thread and my activity is below....Problem is gone.......... ...

<activity android:name=".SensorTest"
        android:windowSoftInputMode="adjustPan" android:screenOrientation="sensor"
        android:configChanges="keyboardHidden|orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
        </intent-filter>
    </activity>

Upvotes: 1

aymeric
aymeric

Reputation: 3895

This is only to try to answer point 1:

You probably miss the following attribute inside <activity> tag in the AndroidManifest.xml. See more here.

android:configChanges="orientation"

If you don't declare this, your app will never be notified of any device rotation.

Upvotes: 1

Related Questions