Issue Description
An unexpected rotation of the video display occurs following the execution of a system-level screenshot while an application is operating in landscape mode on iOS version 26. This orientation shift disrupts the visual consistency of the video preview immediately after the capture event is finalized.
Platform/SDK
Operating System: iOS 26
SDK: Agora RTC SDK for iOS
Root Cause
The orientation discrepancy originates from a synchronization conflict between manual view hierarchy rendering and the built-in system screenshot routine. This behavior is triggered by custom application logic that utilizes a notification observer for the userDidTakeScreenshotNotification event.
Upon receiving the notification, the application invokes a manual capture method that evaluates the status bar orientation and iterates through active windows to execute a secondary drawing process. This process applies rotation transformations to the view hierarchy. Because the operating system concurrently manages the screenshot workflow and associated layout updates, the redundant invocation of these drawing commands forces a state change within the media engine's rendering surface. The overlap of these two processes results in the video display being forced into an incorrect orientation.
Step-by-Step Solution
Deactivate Redundant Notification Observers
Remove the registration for the userDidTakeScreenshotNotification and the associated custom drawing methods within the application initialization. Eliminating the listener prevents the secondary layout update from interfering with the system capture sequence.
Transition to Native Capture Handlers
Rely on the native iOS screenshot functionality to manage the capture and storage of the screen content. The integrated system workflow correctly accounts for device orientation and window hierarchies without necessitating additional application-level transformations.
Implement Asynchronous Execution for Custom Requirements
If the application requires specific metadata or post-processing following a screenshot, ensure that any drawing or rotation adjustments are executed asynchronously. Utilizing a delayed execution path or non-interfering system APIs ensures that the capture logic does not overlap with the primary orientation state updates governed by the application lifecycle.
Summary
The elimination of redundant screenshot handling logic ensures that the video rendering surface maintains its intended orientation. By deferring capture responsibility to the operating system, the application avoids the layout conflicts responsible for unexpected video rotation.