How to make proper video size ?

Qbetechmark

Member
Licensed User
Longtime User
I want to show video a part of my screen, and I got it, but actually the video didn't shrink as big as the videoview, seems the video picture remains full screen and stays behind main screen like this :



(sorry kind of hard to describe it, some one says picture can describe thousand words )

How to resize the video, and it plays inside the videoview ?
 

Qbetechmark

Member
Licensed User
Longtime User

I could not find the thread you mean. Can you give me some clues, how to resize it ? Or any URL to solve the problem ?
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User

:signOops: ouch .... it doesn't works.

my code :

B4X:
Sub Activity_Create(FirstTime As Boolean)
    vv.Initialize("vv")
    Activity.AddView( vv, 10dip, 10dip, 230dip, 180dip)
    vv.LoadVideo(File.DirRootExternal, "mb.wmv")
   vv.Play
   ResizeVideo
End Sub

Sub ResizeVideo
    vv.Left=10dip
    vv.Top=10dip
    vv.Width=230dip    'Set to desired size
    vv.Height=180dip    'Set to desired size
End Sub

Please help. Its urgent for me.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Try this code. This is not the best way for a pause but it is good enough to try. This works fine on my device running Android 2.2. Let use know if this works.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    vv.Initialize("vv")
    Activity.AddView( vv, 10dip, 10dip, 230dip, 180dip)
    vv.LoadVideo(File.DirRootExternal, "mb.wmv")
    vv.Play
    ResizeVideo
End Sub

Sub ResizeVideo
    Dim Tstart As Long
    Tstart = DateTime.Now
    Do While DateTime.Now-Tstart < (Tvar*1000)
    Loop
    vv.Left=10dip
    vv.Top=10dip
    vv.Width=230dip    'Set to desired size
    vv.Height=180dip     'Set to desired size
    vv.LoadVideo(File.DirRootExternal, "mb.wmv")
End Sub
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User

Sorry to tell you, it is still remain the same.
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User
I try these codes below , test in different metdhod and giving no expected result, still remain the same problem :

B4X:
Sub Button1_Click
Dim i As Int
   vvv.LoadVideo(File.DirRootExternal, "mb.wmv")
   For i = 1 To 30000
   Next
   vvv.Height =180dip
   vvv.Width = 230dip
   For i = 1 To 30000
   Next
   vvv.Play
End Sub

Sub Button2_Click
Dim i As Int
   vvv.Height =180dip
   vvv.Width = 230dip
   vvv.LoadVideo(File.DirRootExternal, "mb.wmv")
   For i = 1 To 30000
   Next
   vvv.Play   
End Sub

Sub Button3_Click
Dim i As Int
   vvv.LoadVideo(File.DirRootExternal, "mb.wmv")
   vvv.Play
   For i = 1 To 30000
   Next
   vvv.Height =180dip
   vvv.Width = 230dip
End Sub

Please help.
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User
What device are you running this on? What version of Android is it running? Do you have a .MP4 file to try? The code I sent runs file on 2.2 but it was a .MP4 file. What SDK are you building the app under, API Level 8?

I use AndroidTV, version 2.2, Kernel 2.6.32.9.



SDK 2.2 API 8, screen size 1024 x 600 :





I will try mp4 file.
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User
I've tested this file on Samsung Galaxy Nexus and both the default player and VideoView fail to play it at all.

This is another video file I've try works well, except it plays behind imageview, not inside VideoView. VideoView is in top left, mostly black background.

Please see this movie how the video link above plays good in android TV. Open Youtube.

Please feel free if you have some video files for me to test, or if anyone can tell me how to convert the video for android to work with.
 
Upvote 0

Qbetechmark

Member
Licensed User
Longtime User
I've scale down with video converter software into 176x144, but ... sigh ... it still plays fullscreen. Whats play the video actually, b4a or installed media player ? Maybe we can find more details. The converted video link is here.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…