iOS Question Showing Video full screen in portrait orientation

skrjabin

Active Member
Licensed User
Longtime User
I have an cross platform app that shows also video-tutorials. The app runs in portrait orientation so the videos are also recorded in that format. But the portrait-videos are only shown in the middle of the screen, not full screen. In B4A I use SimpleExoPlayerView and I changed the ResizeMode Property of SimpleExoPlayerView from FIT to FIXED_HEIGHT, that works! But what can I do in B4i with the VideoPlayer Custom view, which does not have such a property?
 

skrjabin

Active Member
Licensed User
Longtime User
I already found and tried this solution to force the orientation:
B4X:
Sub LoadAndPlay
    Dim sFolder As String = s_Folder, sFile As String = s_VideoFile
    VideoPlayer1.LoadVideo(sFolder, sFile)
    Wait For VideoPlayer1_Ready (Success As Boolean)
    If Success Then
        SetOrientation(True)
        VideoPlayer1.Play 'to start playing automatically
    End If
End Sub

'https://www.b4x.com/android/forum/threads/videoview-force-to-landscape-view-in-portrait-only-app.51391/#content
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
But using SetOrientation(True) or (False), it is the same result. The video is only small, in the middle of the screen.
 
Upvote 0

skrjabin

Active Member
Licensed User
Longtime User
Not a square, I tried to rotate the Video into portrait mode, but the software (movie-maker) left the basic 16:9 format, means black area left and right. In Android it was a kind of solution to set SimpleExoPlayerView from FIT to FIXED_HEIGHT, which brought the black stripes out of screen. Now I solved the problem better with another software that really rotates the video, without just putting the portrait- into landscape format.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Not a square, I tried to rotate the Video into portrait mode, but the software (movie-maker) left the basic 16:9 format, means black area left and right. In Android it was a kind of solution to set SimpleExoPlayerView from FIT to FIXED_HEIGHT, which brought the black stripes out of screen. Now I solved the problem better with another software that really rotates the video, without just putting the portrait- into landscape format.
 
Upvote 0
Top