setOrientationHint() does nothing on Gingerbread, but works on later versions
<p>I am trying to record a video in <code>portrait orientation</code>.</p>

<p>Setting the Camera <code>DisplayOrientation</code> to 90 degrees makes the preview to video be displayed in <code>portrait</code>.</p>

<p>But When calling <code>setOrientationHint()</code> with any given number(0,90,180,270) the video that was created is created always in portrait orientation.</p>

<p>When I have tested it on Jellybean and on ICS, the video orientation was the one I set with the <code>setOrientationHint()</code> method.</p>

<p>Here is the <code>MediaRecorder</code> initialization code:</p>

<pre><code>private void initRecorder() {
    Camera camera = Camera.open();
    camera.setDisplayOrientation(90);
    camera.unlock();
    recorder.reset();
    recorder.setCamera(camera);
    recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
    file = new File("/sdcard/test.mp4");
    if (!file.exists()) {
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    recorder.setOrientationHint(90);//doesn't seem to work on 2.3

    recorder.setOutputFile(file.getAbsolutePath());
    recorder.setMaxDuration(30000);
    recorder.setMaxFileSize(1000000);
}
</code></pre>

<p>And this is where I prepare the <code>MediaRecorder</code>:</p>

<pre><code>public void surfaceCreated(SurfaceHolder holder) {
    this.holder = holder;
        recorder.setPreviewDisplay(holder.getSurface());
    try {
        recorder.prepare();
    } catch (IllegalStateException e) {
        e.printStackTrace();
        finish();
    } catch (IOException e) {
        e.printStackTrace();
        finish();
    }
}
</code></pre>

<p><strong>EDIT:</strong> </p>

<p><strong>Tested on:</strong> </p>

<ol>
<li><p>Samsung Galaxy S running android 2.2.</p></li>
<li><p>Samsung Galaxy W running android 2.3.</p></li>
<li><p>Samsung galaxy S2 running ICS - <strong>worked</strong>.</p></li>
<li><p>Samsung galaxy s3 running Jelly Bean - <strong>worked</strong>.</p></li>
</ol>
