Orientation Issue while video recording in Portrait Mode android grafika

拜拜、爱过 提交于 2019-12-06 14:09:37
Ali

Finally after 2 day i solve my problem.

This Solution for Grafika ContinuousCaptureActivity.java

In drawFrame() Method i'll change some code for portrait.

I add below 2 line in drawFrame method:

Matrix.rotateM(mTmpMatrix, 0, 270, 0, 0, 1);
Matrix.translateM(mTmpMatrix, 0, -1, 0, 0); 

In drawFrame Method 2 type to set the glViewport

  • First For Fill the SurfaceView with it. (it means this orientation change while user recording a video)
  • Second For Send it to the video encoder. (it means this orientation change after save the video)

So i'll be change in 2nd opetion

Please find full code at below :

 // Send it to the video encoder.
        if (!mFileSaveInProgress) {
            mEncoderSurface.makeCurrent();
            if (!AppSetting.getValue(activity, Config.ORIENTATION, "").equalsIgnoreCase("Select")) {
                if (AppSetting.getValue(activity, Config.ORIENTATION, "").equalsIgnoreCase("Portrait")) {
                    Matrix.rotateM(mTmpMatrix, 0, 270, 0, 0, 1);
                    Matrix.translateM(mTmpMatrix, 0, -1, 0, 0);
                }
            }
            GLES20.glViewport(0, 0, VIDEO_WIDTH, VIDEO_HEIGHT);
            mFullFrameBlit.drawFrame(mTextureId, mTmpMatrix);
            //drawExtra(mFrameNum, VIDEO_WIDTH, VIDEO_HEIGHT);
            mCircEncoder.frameAvailableSoon();
            mEncoderSurface.setPresentationTime(mCameraTexture.getTimestamp());
            mEncoderSurface.swapBuffers();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!