Android Question videoviewplus video width

hub73

Active Member
Licensed User
Longtime User
videoviewplus
https://www.b4x.com/android/forum/threads/videoviewplus-some-events-added.49329/

@moster67 or others users, have your notice some errors with the returned video width from videoviewplus library ?


Could https://www.b4x.com/android/forum/threads/center-video-with-videoview-solved.40419/ fix the problem ?

(i'm using videoviewplus library and searching a way to center the video, but the returned width seems to be wrong).

Video sample here : https://pixabay.com/fr/videos/canards-des-animaux-étang-l-eau-612

Many thanks.
 

moster67

Expert
Licensed User
Longtime User
I am unsure what your problem is. If it is about centering the videoview, you could try the following code in your Prepared event:

B4X:
Sub CenterVideoView

    If GetDeviceLayoutValues.Width < GetDeviceLayoutValues.Height Then 'portrait
            vvvit5.Top = (100%y - vvvit5.Height) / 2
    Else if GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then 'landscape
          vvvit5.Left = (100%x - vvvit5.Width) / 2
        vvvit5.Top = (100%y - vvvit5.Height) / 2
    End If

End Sub

where vvvit5 is your VideoView object.

If you need to work with real the dimensions of the video, you could try the B4ATextureVideoView wrapper here:
https://www.b4x.com/android/forum/threads/b4atexturevideoview-wrapper-another-videoview.69833/
 
Upvote 0
Top