Issue Description
Upon joining a session within a Windows application based on the Agora APaaS framework, the local video preview may display persistent gray borders on both sides of the frame. This visual artifact indicates that the video is being rendered at a lower resolution or different aspect ratio than intended. The issue typically resolves itself only after a manual camera toggle where the user disables and then re-enables the video feed.
Platform/SDK
Operating System: Microsoft Windows
SDK: Agora APaaS (Flexible Classroom)
Root Cause
The appearance of gray borders is the result of a synchronization mismatch during the media engine startup sequence. Detailed analysis confirms that the startCameraCapture method is being invoked before the underlying video track has been fully instantiated.
When the SDK attempts to initiate capture without an active video track reference, it fails to apply the custom parameters defined in setCameraCapturerConfiguration, such as 1280p at 30 frames per second. To maintain functionality, the engine falls back to a default capture resolution of 960 by 540 at 15 frames per second. Because this default resolution does not match the aspect ratio of the 1280p container, the renderer introduces gray pillarboxing to fill the remaining surface area.
Step-by-Step Solution
Enforce Deterministic Call Sequencing
Modify the application lifecycle to ensure that
startCameraCaptureis only executed after the video track object has returned a successful creation callback. This guarantees that a valid media pipeline exists to receive the high-definition configuration.Provision Explicit Capture Parameters
Rather than relying on separate configuration calls, pass the required resolution and frame rate parameters directly within the
startCameraCapturefunction call. Providing these values during the initial request ensures that the media engine applies the correct dimensions from the first frame, bypassing the need for a system fallback.
Summary
By aligning the camera capture sequence with the media track lifecycle, the local preview will correctly utilize the intended high-resolution parameters upon the first initialization. This implementation eliminates the occurrence of gray borders and ensures a consistent visual experience without requiring user intervention.