iOS Question VideoView force to landscape view in portrait only app?


Active Member
Licensed User
Longtime User
I have an app that has a number of modules, and is restricted to portrait mode only.

However, one module plays videos, and these are always in landscape mode, so I need to re-orientate accordingly.

I was wondering the best approach to achieve this. I have had 2 thoughts about how this could be achieved:-

  • allow the app to support all orientations, but 'block' the event when a rotation happens (I'm not sure what event is raised) apart from in the video view page
  • force the videoview to rotate to landscape mode by bypassing the portrait only restriction somehow (this is what we do in the B4A solution)
I know this is possible in B4a (if anyone requires the code please contact me) but various functions aren't supported on iOS (e.g. SetScreenOrientation in the phone library).

Any thoughts?


B4X founder
Staff member
Licensed User
Longtime User
Currently the video plays in portrait and is too small?

I don't think that you can bypass the portrait only restriction.

It is possible to programmatically change the orientation. It uses a non-public API so Apple may reject your app (my guess is that it will be fine):
Sub SetOrientation(landscape As Boolean)
   Dim no As NativeObject
   Dim value As Int
   If landscape Then value = 4 Else value = 1
   no.Initialize("UIDevice").RunMethod("currentDevice", Null).SetField("orientation", value)
End Sub
Upvote 0


Well-Known Member
Licensed User
Longtime User
I have used Erel's code to show only VideoView page in landscape, app is "forced" to be in portrait mode.
My app passed review.
Upvote 0