Android Question VideoView1 & VideoView2 Multiple Use?

ronovar

Active Member
Licensed User
Longtime User
I need to show two different videos in my apk. So i added VideoView1 and VideoView2 components to show videos in my apk. I added 2 different urls for both VideoView components and only first video is played second video displays message this video cannot be played.

Is there solution to make work two VideoView compomponents with two different URLs?

Here is code that i try:

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim VideoView1, VideoView2 As VideoView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   
    'INIT - VideoView
    VideoView1.Initialize("VideoView1")
    'Initialize VideoViewRelativeLayout
    Dim VideoViewRelativeLayout1 As VideoViewRelativeLayout
    VideoViewRelativeLayout1.Initialize
    'Add VideoView To VideoViewRelativeLayout
    VideoViewRelativeLayout1.SetVideoView(VideoView1)
    VideoView1.LoadVideo("http", "http://myURLA.com")
    VideoView1.Play

    
    'INIT - VideoView
    VideoView2.Initialize("VideoView2")
    'Initialize VideoViewRelativeLayout
    Dim VideoViewRelativeLayout2 As VideoViewRelativeLayout
    VideoViewRelativeLayout2.Initialize
    'Add VideoView To VideoViewRelativeLayout
    VideoViewRelativeLayout2.SetVideoView(VideoView2)
    VideoView2.LoadVideo("http", "http://myURLB.com")
    VideoView2.Play

    
    'ADDVIEW - VideoView
    Activity.AddView(VideoViewRelativeLayout1, 0, 0, 100%x, 100%y)
    Activity.AddView(VideoViewRelativeLayout2, 0, 50%y, 100%x, 100%y)
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
I dont think it is possible
 
Upvote 0

GudEvil

Member
Licensed User
Longtime User
I had a requirement before somethig like this.

What I did is I initialized multiple videoview , and added touch to each videoview.

Once videoview touch is pressed then that video is loaded from specific url n then it plays.
Also you can click on another videoview n play second too...

if you want something like this let me know, I can help you more...

thanks
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
That was excellent idea...so only touch event and ready to go...i will try with timer delay it should work...will post result later...i im now finished listview scroller from bottom to top using 2D array.
 
Upvote 0

GudEvil

Member
Licensed User
Longtime User
no need to use timer either.


Just initialized panel...with click event enabled
add videoview to the panel.
once click event is generated for particular videoview_id ..load video from its url.. n play...

-m

glad I am able to help someone. its been times where I was seeking help for answers n this community is provided me all the time...
Hats-off to the b4a community..
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
Yes b4a community is great...we have here all questions and answers from skilled people...who wants to help and share their knowledge... if you can post simple code it will be great..i got your idea but would like to see your code.
 
Upvote 0
Top