Android Question More VideoView Queries

RJB

Active Member
Licensed User
Longtime User
Hi,
Using this code to test videoview functionality:

B4X:
Sub Globals
    Dim vv1 As VideoView
    Dim vv2 As VideoView
    Dim button1 As Button
    Dim button2 As Button
End Sub
 
Sub Activity_Create(FirstTime As Boolean)
    vv1.Initialize("vv1comp")
    vv2.Initialize("vv2comp")
    button1.Initialize("btn1")
    button2.Initialize("btn2")
    Activity.AddView(vv1, 10dip, 10dip, 200dip, 200dip)
    Activity.AddView(vv2, 110dip, 110dip, 200dip, 200dip)
    Activity.AddView(button1, 10dip, 410dip, 90dip, 50dip)
    Activity.AddView(button2, 110dip, 410dip, 90dip, 50dip)
    button1.Text = "1 on top"
    button2.Text = "2 on top"
 
    vv1.MediaControllerEnabled = False
    vv1.MediaControllerEnabled = False
    vv1.LoadVideo(File.DirRootExternal & "/Movies", "movie1.MOV")
    vv2.LoadVideo(File.DirRootExternal & "/Movies", "movie2.MOV")
    vv1.Play
    vv2.play
 
 
End Sub
 
Sub vv1comp_complete
    vv1.LoadVideo(File.DirRootExternal & "/Movies", "movie1.MOV")
    vv1.Play
End Sub
Sub vv2comp_complete
    vv2.LoadVideo(File.DirRootExternal & "/Movies", "movie2.MOV")
    vv2.play
End Sub
 
Sub btn1_click
'    vv1.SendToBack
    vv1.BringToFront
    vv1.play
End Sub
Sub btn2_click
'    vv2.SendToBack
    vv2.BringToFront
    vv2.play
End Sub

Gives me the following problems:
1) it doesn't matter which statement (sendtoback or bringtofront) is enabled in the 'click' subs, the video is always sent to the back when a button is touched
2) the video re-starts when it is sent to the back, rather than continuing to play

Any ideas as to where I'm going wrong?
 

RJB

Active Member
Licensed User
Longtime User
Further information:
I tried the code on another two devices and it won't run properly, they don't seem able to run two videos at once. Possibly single core devices?
On the original one if I add
vv1.Color = Colors.Red
vv2.Color = Colors.Blue
then the colours block out the video (perhaps that's how it should work?) and the bringtofront/ sendtoback seem to work properly. However if I only colour one and leave the other 'uncoloured' then I get the following:
with vv1 coloured vv1.bringtofront shows the full coloured block of vv1 and the video in the uncovered section of vv2. vv2.bringtofront shows video on the whole of vv2, however the video on the overlapping section is from vv1. Hence if the video was showing on vv1 it would have looked like vv1 was in front. The opposite is true if vv2 is coloured and vv1 shows the video.
 
Upvote 0
Top