Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local video orientation is incorrect starting 3.7.0 #293

Open
ArcherEmiya05 opened this issue Jul 27, 2022 · 3 comments
Open

Local video orientation is incorrect starting 3.7.0 #293

ArcherEmiya05 opened this issue Jul 27, 2022 · 3 comments

Comments

@ArcherEmiya05
Copy link

ArcherEmiya05 commented Jul 27, 2022

Migrating from 3.4.2 to 3.7.0, CreateRendererView has been deprecated thus we update it using the plain SurfaceView

Old code

SurfaceView surface = RtcEngine.CreateRendererView(this);
        surface.setZOrderOnTop(true);
        rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas.RENDER_MODE_FILL, 0));
        mLocalPreview.addView(surface);

New code

SurfaceView surface = new SurfaceView(this);
        surface.setZOrderOnTop(true);
        rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas.RENDER_MODE_FIT, 0));
        mLocalPreview.addView(surface, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

The issue is the local video is now always landscape but its rendered remote is fine.

This is the configuration,


public static final VideoEncoderConfiguration.VideoDimensions[] VIDEO_DIMENSIONS = new VideoEncoderConfiguration.VideoDimensions[] {
            VideoEncoderConfiguration.VD_320x240,
            VideoEncoderConfiguration.VD_480x360,
            VideoEncoderConfiguration.VD_640x360,
            VideoEncoderConfiguration.VD_640x480,
            VideoEncoderConfiguration.VD_840x480,
            VideoEncoderConfiguration.VD_960x720,
            new VideoEncoderConfiguration.VideoDimensions(960, 540),
            VideoEncoderConfiguration.VD_1280x720
    };

    public static final int DEFAULT_PROFILE_IDX = 7;

rtcEngine().setVideoEncoderConfiguration(new VideoEncoderConfiguration(
                    AgoraConstants.VIDEO_DIMENSIONS[AgoraConstants.DEFAULT_PROFILE_IDX],
                    VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_30,
                    VideoEncoderConfiguration.STANDARD_BITRATE,
                    VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT
            ));
            

image

@ArcherEmiya05
Copy link
Author

I discover that the culprit is changing RtcEngine.CreateRendererView(this); to new SurfaceView(this); but it was stated here #283 that it is no longer recommended starting v4.

@plutoless
Copy link
Contributor

you are using fill before but now using fit.
rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas.RENDER_MODE_FILL, 0));
rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas. RENDER_MODE_FIT, 0));

@ArcherEmiya05
Copy link
Author

you are using fill before but now using fit. rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas.RENDER_MODE_FILL, 0)); rtcEngine().setupLocalVideo(new VideoCanvas(surface, VideoCanvas. RENDER_MODE_FIT, 0));

Fill is no longer available in SDK v4, the changes was meant to prepare it for migration. However is changing render mode the reason for it to rotate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants