开发者

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


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();


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>


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜