logo
Video Call
On this page

Video Capture Rotation

2024-01-02

Feature Introduction

ZEGO provides 4 capture rotation modes for mobile devices (fixed ratio mode, adaptive mode, alignment mode, and custom mode) to simplify the complex adaptation problems developers face when implementing multi-terminal rotation performance, such as camera angle, resolution, automatic rotation, status bar position adaptation, etc. You can configure different modes through the setAppOrientationMode interface according to rotation performance and business scenario requirements.

Warning
  • To ensure the expected effect, the publishing and playing ends need to maintain the same mode during a call or in the same room.
  • The publishing and playing stream versions need to be v2.23.0 or above at the same time to use adaptive and alignment modes, so it is recommended to use them in new applications.
  • PC, Web, and stream mixing services have adapted to the rotation mode. Since they do not have the rotation characteristics of mobile devices, the status bar is at the top of the screen by default.
  • Fixed ratio mode supports all protocol scenarios. Adaptive and alignment modes only support ZEGO RTC private protocol and ZEGO stream mixing service.

Fixed Ratio Mode

In fixed ratio mode, the video output direction always maintains a fixed ratio relative to the status bar, and the video picture ratio depends on the encoding resolution ratio.

Advantages: Fixed ratio mode is suitable for all scenarios and is also a commonly used mode in live streaming scenarios. In this mode, the rotation of the video picture is handled at the capture end, and the playing end does not need additional processing, so there is no compatibility issue with live streaming distribution channels.

When the encoding ratio is portrait, the publishing and playing stream performance is as follows:

  • UI fixed to portrait:

  • UI not locked (enable App screen automatic rotation):

Adaptive Mode

In adaptive mode, regardless of the holding method or UI orientation, the image will always remain vertically facing upward.

Advantages: In adaptive mode, users can choose their favorite holding method for video calls, suitable for 1v1 or multiplayer video RTC scenarios. You can also implement live streaming business through stream mixing and forwarding.

Warning
  • Adaptive mode does not support direct publishing to CDN. If you need live streaming, you can use the ZEGO stream mixing service to process multi-person picture rotation performance, and then forward to CDN. If necessary, please contact ZEGO technical support to enable this configuration.
  • Adaptive mode records information such as camera angle, holding method, and status bar position in the ZEGO private transmission protocol, so it only supports ZEGO RTC protocol and ZEGO stream mixing service.

The performance is as follows:

Alignment Mode

In alignment mode, using the status bar as a reference, the video direction at the playing end is consistent with the video direction of the publishing end preview. The playing end will rotate the image with reference to the status bar. The rotation angle at the playing end is consistent with the rotation angle of the publishing end preview.

Advantages: Alignment mode is similar to adaptive mode, but users can combine the automatic rotation switch and holding method to actively adjust full-screen or aspect-ratio scaled picture performance, suitable for 1v1 or multiplayer video RTC scenarios.

Warning
  • Alignment mode does not support direct publishing to CDN. If you need live streaming, you can use the ZEGO stream mixing service to process multi-person picture rotation performance, and then forward to CDN. If necessary, please contact ZEGO technical support to enable this configuration.
  • Alignment mode records information such as camera angle, holding method, and status bar position in the ZEGO private transmission protocol, so it only supports ZEGO RTC protocol and ZEGO stream mixing service.
  • When UI is fixed to portrait:

  • When UI is fixed to landscape:

  • UI not locked (enable App screen automatic rotation):

Custom Mode (Default)

In custom mode, you can customize the video capture rotation performance form according to your needs. The implementation method is more flexible. For specific implementation steps, please refer to How to customize video capture rotation mode?

Implementation Flow

Warning

The following implementation flow only applies to fixed ratio mode, adaptive mode, and alignment mode. If you need to customize the video capture rotation mode, please refer to How to customize video capture rotation mode?

Publishing end

The publishing end needs to call the setAppOrientationMode interface to set any capture rotation mode.

Warning

Please call the setAppOrientationMode interface immediately after calling createEngineWithProfile, and then call the startPublishingStream or startPreview interface.

Playing end

Only in adaptive mode, the playing end needs to call the setAppOrientationMode interface to set the adaptive mode before playing stream.

Warning
[[ZegoExpressEngine sharedEngine]setAppOrientationMode:ZegoOrientationModeAdaption];

Previous

Common Video Configuration

Next

Screen Sharing

On this page

Back to top