yutasuzuki / react-native-record-screen

react-native-record-screen
MIT License
149 stars 40 forks source link

On iOS when recording on landscape the output video is in portrait mode #56

Open medmo7 opened 2 years ago

medmo7 commented 2 years ago

Thank you for this library. I want to record the screen while the orientation is in landscape mode, android works great but on iOS the output video is in portrait mode and the aspect ratio is not good. I'm changing the app orientation programmatically on the screen I want to record.

thanks

umbertoghio commented 2 years ago

Hi, got the same issue myself but was easy to resolve after checking the native code. Every time the recording starts it calls a setup method that accepts the following:

{
    mic,
    width,
    height
  }

Just call the startRecording with the appropriate screen width and height, I have a listener for screen orientation so I save in a variable the dimensions of my screen, width and height are swapped when rotated:

RecordScreen.startRecording({
    mic: true,
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height
  })
HBiSoft commented 2 years ago

There's also a setOrientationHint method available.