Android Question Videoview question

Discussion in 'Android Questions' started by Ricardo Bunschoten, Jul 6, 2015.

  1. Ricardo Bunschoten

    Ricardo Bunschoten Member Licensed User

    Is it possible when using videoview to play the video default in Landscape ?

    i now use this code

    Code:
    Sub test_Click
     
    Activity.AddView(vv, 10dip10dip550dip550dip)
     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
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    you can use the phone lib and set the activity to landscape, something like this:
    Code:
    Dim p As Phone 'this varaible you put into globals
    Sub test_Click
    p.SetScreenOrientation(
    0'setting landscape

    Activity.AddView(vv, 10dip10dip550dip550dip)
    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)
     
    DonManfred likes this.
  3. Ricardo Bunschoten

    Ricardo Bunschoten Member Licensed User

    Thank you :)

    Love this community :)
     
    RandomCoder likes this.
  4. Ricardo Bunschoten

    Ricardo Bunschoten 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 ?
     
  5. eurojam

    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:
    Code:
    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
     
  6. Ricardo Bunschoten

    Ricardo Bunschoten Member Licensed User

Loading...