VideoView always full screen

robotop

Member
Licensed User
Longtime User
Hello, I have a MP4 video file on external SD card and it it's perfectly viewable if I set the player as Activity.Addview with full screen size. Now, I want to use just a part of the screen for player, but the result is that there is a sort of "active window" that's of the dimensions I set, but the player is always on full screen with alpha-blending. This is the code for activation:
(note: the initialization is done in a previous part of the program)
B4X:
        vv.Visible = False
   vv.LoadVideo(File.DirRootExternal,"/aires/vid/video1.mp4")
   Activity.AddView(vv, 10dip, 100dip, 320dip, 240dip) ' add video player
after this, there is an active animation of 2 seconds for other elements; at animation end the code is:
B4X:
   vv.MediaControllerEnabled = False
   vv.Visible = True
   vv.Play
The behaviour is the video played, but in full screen alpha-blending and upper left part as normal video.
What is wrong ? How can I play a video in a reduced size player ? Must I create some smaller size video as suggested in a couple of posts I've read here ? Is the automatic resizing possible by software ?
Thanks in advance...
 
Last edited:

pluton

Active Member
Licensed User
Longtime User
Just change your video size

B4X:
Activity.AddView(vv, 10dip, 100dip, 320dip, 240dip) ' add video player with 320x 240 size
' you can put your custom size for example 
vv.setlayout(10dip, 100dip, 100dip, 100dip) ' set layout of video player to 100 x 100
 
Upvote 0

robotop

Member
Licensed User
Longtime User
Hello, thanks for your prompt answer, but the vv.setlayout was my first try, obviously, and hasn't effect, upper left corner isn't shadowed, the rest of screen is alpha-blended, as if you don't put the statement it in the program.
No effect in my application adding or removing this line prior to start the play:

B4X:
    vv.SetLayout(10dip,100dip,320dip,240dip)
In my opinion there will be some setting at higher level to tell the video-player to shrink the video font to fit an arbitrary sized window. Any other suggestion for me, please ?

P.S. additional infos: I'm using a 1024x768 tablet (9.7")

P.S2 (still post scriptum, not game console
I launched the same video using "MyVideo" program from the tablet's menu. The problem is the same, but there are 3 chances: you can see the video in 1:1 format (that's a window in the middle of player) or in fill-screen format (the 16:9 videos will be vertically enlonged) or in 16:9 mode, but there isn't any arrow, cursor, angle to glide to stretch the image to arbitrary dimension, so I think the B4A calls this player and that's the way it can't resize. What about this thought ?
 
Last edited:
Upvote 0

pluton

Active Member
Licensed User
Longtime User
Can you give us a screenshot of what happen to video.

BTW
What resolution size is your MP4 video file?
 
Upvote 0

robotop

Member
Licensed User
Longtime User
hello, the video native resolution is 638x360, mp4. In this moment I can't take a screen-shot, but imagine you have a transparent window of 100x100 (for example) on a foggy glass. The transparent part is the zone of video you can see (for example, just the head of a singer, while the whole band is behind the fog of alpha-blending). The player, with or without media controls, occupies the whole screen in horizontal size, so 1024 pixels in my tablet. When you set the Activity.addview, you set the space you want to designate to such activity, so the setlayout, in my opinion, is not needed. But I tried it, by myself, at first instance. I think the B4A wraps a call to default library for the video player. I suspect that my tablet (modded to Uberoid to gain access to some root features I need for) will have a different player and can't resize or shrink a video with the "standard" instructions posted by Erel. Tomorrow I will try a couple of suggestions I read on the forum from "Gabrielle" (if I don't remember bad). The suggestions was about loading a small video (of about 1 sec time and 320x240 in size) just to "force" the player to set its defaults on such dimensions. I will try, but I doubt it will work in my case. I think there is something different in the player and in the methods it exposed to the caller. But, every solution will be accepted, with enthusiasm
 
Upvote 0

robotop

Member
Licensed User
Longtime User
Ok, I have done some additional tests, after reading about the method proposed by "Gabrielle" in another thread (using short videos of different sizes with just 1 sec time, in order to force the player to resize following video to that size); here are the results:

1) created new video converting the MP4 in AVI, same size 638x360.
The file is played only in audio. The video window remains black, with the size I selected starting the vv.

2) created new video resizing MP4 from 638x360 to 320x180.
The file is played in audio and video, but the problem is the same as described in previous posts, the only difference is that artefacts are big 'cause the player forces video to expand.

3) created new AVI 320x180 from the small MP4.
As for the biggest one, the file was played only in audio. The video window remained black.

So, I think the player auto-expands on whole video (with alpha-blending on the zone that's outside the layout imposed by my application) if the source is MP4, and can't play "normal" AVI video.

Has someone an idea on how to solve this problem ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…