Issue Description:
When attempting to share a full-screen view (such as a game screen) during streaming using the screen capture method, only a portion of the iOS screen appears on the viewer’s side instead of the entire display.
Platform/SDK:
iOS using the Agora Video SDK (4.x)
Error Message:
None displayed.
Step by Step Solution:
1. Review your rendering mode configuration:
- Locate where you configure the remote video rendering settings using AgoraRtcVideoCanvas.
- Check the renderMode property of the canvas.
2. Update the render mode to fit the full screen:
- If your current setting is .hidden, it maintains the aspect ratio by cropping part of the image.
- Change the value to .fit instead. This ensures the entire screen content is displayed without cropping.
Example:
swift
let videoCanvas = AgoraRtcVideoCanvas()
videoCanvas.uid = remoteUid
videoCanvas.view = remoteView
videoCanvas.renderMode = .fit
agoraKit.setupRemoteVideo(videoCanvas)
3. Restart screen sharing and validate the display:
- Restart the screen sharing session.
- Confirm that the entire iOS screen (including all edges) is visible to remote participants.
4. Optional: Adjust screen capture parameters:
- If resolution or clarity is not as expected, consider customizing the screen capture settings using AgoraScreenVideoParameters.
- You can adjust parameters such as resolution, frame rate, and bitrate to match your desired quality.
Root Cause:
The issue occurred because the render mode was set to .hidden. This mode scales and crops the video to fill the display area, resulting in partial screen visibility. Switching to .fit ensures the full screen content is visible without cropping.
Prevention/Best Practice:
- Always review your video rendering mode configuration (fit, hidden, or adaptive) based on how you want the content to appear.
- Test screen sharing between different platforms (iOS, Android, and Web) to ensure consistent visual results.
- Maintain the default or appropriate capture resolution for your use case (e.g., 1280x720 for most iOS screen-sharing scenarios).
Corresponding Document/Link:
- Agora iOS Screen Sharing Setup Guide