Mobile recording is saved in cropped landscape mode. How to record portrait video?

I have developed a small web based app, where the end-user can record a video that is saved on the server. Everything works fine, the user clicks the record button in the webpage on his phone, a recording session is created by REST API, and the user sees a portrait video on his mobile screen.

However, when the recording is stopped, the video file is saved on the server is in landscape mode, that too cropped from the portrait mode that is displayed from the user’s side. This means that the video is a cropped portion of the actual video that was displayed to the user.

I have searched extensively in Google groups, Github issues and the docs, but nothing comes close to this issue.

Can anyone help me find what I am missing?

Nevermind, found out the fix.

I needed to pass the resolution in the API for starting recording.

"outputMode": "COMPOSED", "resolution":"480x640"

This didn’t solve my issue. The video looks ok on dashboard but when saving it crops from edges.