Video Capture Rotation
Feature Overview
ZEGO provides 4 capture rotation modes for mobile devices (Fixed Ratio Mode, Adaptive Mode, Alignment Mode, and Custom Mode) to simplify the complex adaptation issues faced by developers when implementing multi-terminal rotation performance, such as camera angle, resolution, automatic rotation, StatusBar position adaptation, etc. You can configure different modes through the setAppOrientationMode interface according to rotation performance and business scenario requirements.
- To ensure the expected effect, it is necessary for the publishing and playing sides to maintain the same mode during a call or in the same Room.
- The publishing and playing stream versions need to be above v2.23.0 at the same time to use adaptive and alignment modes, so it is recommended that you use them in new applications.
- PC, Web, and stream mixing services have adapted the rotation mode. Since they do not have the rotation characteristics of mobile devices, the StatusBar defaults to the top of the screen.
- 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 StatusBar, and the video picture ratio depends on the encoding resolution ratio.
Advantage: Fixed Ratio Mode is suitable for all scenarios and is also a commonly used mode in live streaming scenarios. This mode handles the rotation of the video picture at the capture end, and the playing stream end does not need additional processing, so there is no compatibility issue with live streaming distribution channels.
When the encoding ratio is vertical screen, the performance of publishing and playing stream ends is as follows:
-
UI fixed to vertical screen:

-
UI not locked (App screen auto-rotation enabled):

Adaptive Mode
In Adaptive Mode, regardless of the holding method or UI orientation, the image will always remain vertically facing up.
Advantage: In Adaptive Mode, users can choose their favorite holding method for video calls, suitable for RTC scenarios such as 1v1 or multi-person video. You can also implement live streaming business through stream mixing and relay.
- Adaptive Mode does not support direct relay to CDN. If you need live streaming, you can use ZEGO stream mixing service to process multi-person picture rotation performance, and then relay to CDN. If needed, please contact ZEGOCLOUD Technical Support to enable this configuration.
- Adaptive Mode records information such as camera angle, holding method, and StatusBar position in the ZEGO private transmission protocol, so it only supports ZEGO RTC protocol and ZEGO stream mixing service.
Performance is as follows:

Alignment Mode
In Alignment Mode, using the StatusBar as a reference, the video direction of the playing stream end is consistent with the preview video direction of the publishing stream end. The playing stream end will use the StatusBar as a reference to rotate the image, and the rotation angle of the playing stream end is consistent with the rotation angle of the publishing stream end preview.
Advantage: Alignment Mode is similar to Adaptive Mode, but users can actively adjust the full-screen or equal-ratio scaling picture performance by combining the auto-rotation switch and holding method, suitable for RTC scenarios such as 1v1 or multi-person video.
- Alignment Mode does not support direct relay to CDN. If you need live streaming, you can use ZEGO stream mixing service to process multi-person picture rotation performance, and then relay to CDN. If needed, please contact ZEGOCLOUD Technical Support to enable this configuration.
- Alignment Mode records information such as camera angle, holding method, and StatusBar position in the ZEGO private transmission protocol, so it only supports ZEGO RTC protocol and ZEGO stream mixing service.
-
When UI is fixed to vertical screen:

-
When UI is fixed to horizontal screen:

-
UI not locked (App screen auto-rotation enabled):

Custom Mode (Default)
In Custom Mode, you can customize the video capture rotation performance according to your needs, making the implementation more flexible. For specific implementation steps, please refer to How to customize video capture rotation method?
Implementation Process
The following implementation process only applies to Fixed Ratio Mode, Adaptive Mode, and Alignment Mode. If you need to customize the video capture rotation method, please refer to How to customize video capture rotation method?
Publishing Stream End
The publishing stream end needs to call the setAppOrientationMode interface to set any capture rotation mode.
Please call the setAppOrientationMode interface immediately after calling createEngine, and then call the startPublishingStream or startPreview interface.
ZegoExpressEngine.getEngine().setAppOrientationMode(ZegoOrientationMode.FIXED_RESOLUTION_RATIO);Playing Stream End
Only in Adaptive Mode, the playing stream end needs to call the setAppOrientationMode interface to set Adaptive Mode before playing stream.
- Please call the setAppOrientationMode interface immediately after calling createEngine to set the video orientation mode, and then call startPlayingStream to start playing stream.
- In Adaptive Mode, only supports playing stream from RTC.
ZegoExpressEngine.getEngine().setAppOrientationMode(ZegoOrientationMode.ADAPTION);