Webview not showing video

tomb

Member
Licensed User
Longtime User
The webview from the tutorial reads and loads the mp4 from sdcard-ext but only plays the sound and no video. The test mp4s are one I download from Apple and a small one I created. When the video first begins a small control bar shows at the bottom of the screen and at the end the log displays "playing complete". Test is on Droid X2.

Atttached is the sample file .zip

Best Tom B
 

Attachments

  • slideshow-simple.zip
    1.3 KB · Views: 222

tomb

Member
Licensed User
Longtime User
The regular Android browser on my Droid X2 will play the .mp4 movies at
Index of /android/movies

I loaded them to sdcard-ext so the app could find them.
sdf = "/mnt/sd-card-ext/appfolder/"

vv.LoadVideo(sdf, "chuhuly.mp4")

The app only plays sound. Perhaps there is some setting that controls the video. Is the size on AddView critical?

vv.Initialize("vv")
Activity.AddView(vv, 10dip, 10dip, 600, 400)

Best,
Tom B
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
This code works for me, video and sound.
B4X:
'Activity module

Sub Process_Globals
   
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules. 

End Sub

Sub Globals
    
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim Player As VideoView

End Sub

Sub Activity_Create(FirstTime As Boolean)

    Player.Initialize("Player")
    
    Activity.AddView(Player, 0dip, 0dip, 100%x, 100%y)
   
    Player.LoadVideo("http", "http://thomasofneedham.com/android/movies/chuhuly.mp4")
    Player.Play

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause(UserClosed As Boolean)

End Sub

The size of the VideoView doesn't matter, you can replace this line:

From:
B4X:
Activity.AddView(Player, 0dip, 0dip, 100%x, 100%y)

To:
B4X:
Activity.AddView(Player, 0dip, 0dip, 100dip, 100dip)

And still get video and sound.
 
Last edited:
Upvote 0

tomb

Member
Licensed User
Longtime User
Hello All,

The simplified logic worked on my Droid just fine. I tried it both from the internet and from the the sdcard-ext and both ways worked. Now all I have to do is figure out why my more complicated version didn't play the video.

Thanks,
Tom B
 
Upvote 0
Top