title: MediaRecorder video capturing in portrait mode
body: <p>I'm try to make custom video app. Iwork using settings in manifest <strong>2.2 only (API 8).</strong></p>
  
  <p>All goes well but I don't understand why portrait mode video does not differ from lanscape one.</p>
  
  <p>To make detection of device changed orientation I use this code within surfaceChanged()</p>
  
  <pre><code>        if (mCamera != null) {
  
          Camera.Parameters p = mCamera.getParameters();
  
          try {
              mCamera.stopPreview();
          } catch (Exception e) {
              // TODO: handle exception
          }
  
          int previewWidth = 0;
          int previewHeight = 0;
  
          if (mPreviewSize != null) {
              Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
              int rotation = display.getRotation();
  
              switch (rotation) {
              case Surface.ROTATION_0:
                  previewWidth = mPreviewSize.height;
                  previewHeight = mPreviewSize.width;
                  mCamera.setDisplayOrientation(90);
                  break;
  
              case Surface.ROTATION_90:
                  previewWidth = mPreviewSize.width;
                  previewHeight = mPreviewSize.height;
                  mCamera.setDisplayOrientation(0);
                  break;
  
              case Surface.ROTATION_180:
                  previewWidth = mPreviewSize.height;
                  previewHeight = mPreviewSize.width;
                  mCamera.setDisplayOrientation(270);
                  break;
  
              case Surface.ROTATION_270:
                  previewWidth = mPreviewSize.width;
                  previewHeight = mPreviewSize.height;
                  mCamera.setDisplayOrientation(180);
                  break;
              }
  
              p.setPreviewSize(previewWidth, previewHeight);
              mCamera.setParameters(p);
          }
      try {
          mCamera.setPreviewDisplay(mHolder);
          mCamera.startPreview();
      } catch (Exception e) {
          Log.d(TAG, "Cannot start preview.", e);
      }
  }
  </code></pre>
  
  <p>Works like a charm. If I rotate device surface change orientation, calling surfaceChanged, where camera is set to appropriate DisplayRotation.</p>
  
  <p>The question is how to determine later if the video captured either in lanscape mode or in portrait one. As I got all the videos are captured in landscape orientation. It does not depend of setDisplayOrientation which affect only preview process.</p>
  
  <p>Also exploring the problem I noticed that if to use standard Camera app it writes special tag to video file (seen in MediaInfo): <strong>Rotation : 90</strong> for the portrait captured videos.</p>
  
  <p>But MediaRecorder class does not.</p>
  
  <p>Seems that is the problem. Anybody got to solve this?</p>