Hi Eric.
Here's a little library that achieves the same as that blog post.
I've named the library VideoViewExtras, it has just a single object named VideoViewRelativeLayout.
Here's the documentation:
VideoViewExtras
Version: 1.00
- VideoViewRelativeLayout
Methods:
- Initialize
Initialize the VideoViewRelativeLayout.
VideoViewRelativeLayout is now a RelativeLayout with Width and Height both set to the Android constant MATCH_PARENT.
(MATCH_PARENT is the same as FILL_PARENT but FILL_PARENT is now deprecated).
- IsInitialized As Boolean
- SetVideoView (VideoView1 As VideoView)
Add a VideoView to the RelativeLayout.
The VideoView Width and Height are both set to the Android constant MATCH_PARENT.
Additionally the VideoView Layout Align is set to ALIGN_PARENT_BOTTOM, ALIGN_PARENT_LEFT, ALIGN_PARENT_RIGHT and ALIGN_PARENT_TOP.
That's all pretty self-explanatory, and here's the B4A VideoView example code modified to use the new VideoViewRelativeLayout:
Sub Process_Globals
End Sub
Sub Globals
Dim vv As VideoView
End Sub
Sub Activity_Create(FirstTime As Boolean)
' http://www.b4x.com/android/help/audio.html#videoview
' this is the basic VideoView example modified to use ViewViewExtras and it's VideoViewRelativeLayout1 object
vv.Initialize("vv")
' do not add the VideoView to the Activity
' Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)
' create and Initialize the VideoViewRelativeLayout1
Dim VideoViewRelativeLayout1 As VideoViewRelativeLayout
VideoViewRelativeLayout1.Initialize
' add the VideoView to the VideoViewRelativeLayout1
VideoViewRelativeLayout1.SetVideoView(vv)
' now add the VideoViewRelativeLayout1 to the Activity
Activity.AddView(VideoViewRelativeLayout1, 10dip, 10dip, 250dip, 250dip)
vv.LoadVideo(File.DirRootExternal, "somefile.mp4")
vv.Play
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Library files are attached.
Martin.