Android Question Videoview question

Ricardo Bunschoten

Active Member
Licensed User
Is it possible when using videoview to play the video default in Landscape ?

i now use this code

B4X:
Sub test_Click
 Activity.AddView(vv, 10dip, 10dip, 550dip, 550dip)
 vv.
 vv.LoadVideo("http","http://144.76.3.83/sky_sports1gb.m3u8?bandwidth=956&token=205e6dc135bf9e7fe3da60d6ba052211&user=35430&playlistlength=25&os=browser")
 vv.Play
 End Sub
This works perfect but i want the video to load default in landscape since the app is by default in portrait.

Thnx in advance
 

eurojam

Well-Known Member
Licensed User
you can use the phone lib and set the activity to landscape, something like this:
B4X:
Dim p As Phone 'this varaible you put into globals
Sub test_Click
p.SetScreenOrientation(0) 'setting landscape

Activity.AddView(vv, 10dip, 10dip, 550dip, 550dip)
vv.LoadVideo("http","http://144.76.3.83/sky_sports1gb.m3u8?bandwidth=956&token=205e6dc135bf9e7fe3da60d6ba052211&user=35430&playlistlength=25&os=browser")
vv.Play
End Sub

'when the viedeo finished then set to portrait with
p.SetScreenOrientation(1)
 

Ricardo Bunschoten

Active Member
Licensed User
I tried your code the screen rotates but the video does not start

I have to press again the button in landscape mode and then the video starts ?
 

eurojam

Well-Known Member
Licensed User
I have also some apps using video in landscape mode and my app is in portrait, where I prefer starting the video in a new activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)

    p.SetScreenOrientation(0)
    Activity.LoadLayout("l5")

    If File.Exists(File.DirInternal, video) = False  Then
        File.Copy(File.DirAssets, video, File.DirInternal, video)
    End If
    vv.Initialize("videoview")
    pContent.AddView(vv,0,40dip,100%x,100%y-40dip)
    vv.LoadVideo( File.DirInternal, video)
    vv.Play

End Sub
This works

Best regards
stefan
 
Top