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 ?
Sub Globals
Dim vv As VideoView
End Sub
Sub ResizeVideo
vv.Left=0
vv.Top=0
vv.Width=1024 'Set to desired size
vv.Height=600 'Set to desired size
End Sub
Sub Globals
Dim vv As VideoView
End Sub
Sub ResizeVideo
vv.Left=0
vv.Top=0
vv.Width=1024 'Set to desired size
vv.Height=600 'Set to desired size
End Sub
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
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
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
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
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?
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?
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.
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.