B4A Library videoviewExt Lib write by IceFairy

Hi,
this is my lib,It's different from the organizational one,It can zoom in video file!you can test by yourself!:sign0060:
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 vvv As VideoViewExt
Dim pp As Phone
End Sub

Sub Activity_Create(FirstTime As Boolean)
'icemod.phone1.SetScreenOrientation(0)
vvv.Initialize("vv1")
'vve.Initialize("vve")
Log(icemod.playerfn)
vvv.LoadVideo(icemod.mypath,icemod.playerfn)
Activity.AddView(vvv,0,0,Activity.Width,Activity.Height)
vvv.Play
End Sub
Sub vv1_Complete
   Log("complete")
End Sub
Sub Activity_Resume
pp.SetScreenOrientation(0)
End Sub

Sub Activity_Pause (UserClosed As Boolean)
pp.SetScreenOrientation(1)
End Sub
 

Attachments

  • vvelib&IceFairy.zip
    11.9 KB · Views: 1,273

bluedude

Well-Known Member
Licensed User
Longtime User
So eh, what is this? Can you explain a little more?

Is this to load a local video file or what?

Cheers,
 

sally3599

Member
Licensed User
Longtime User
got a error message

A error message:
B4X:
Compiling code.                         Error
Error parsing program.
Error description: Undeclared variable 'icemod' is used before it was assigned any value.
Occurred on line: 19
Log(icemod.playerfn)

Example is same:
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 vvv As VideoViewExt
Dim pp As Phone
End Sub

Sub Activity_Create(FirstTime As Boolean)
'icemod.phone1.SetScreenOrientation(0)
vvv.Initialize("vv1")
'vve.Initialize("vve")
Log(icemod.playerfn)
vvv.LoadVideo(icemod.mypath,icemod.playerfn)
Activity.AddView(vvv,0,0,Activity.Width,Activity.Height)
vvv.Play
End Sub
Sub vv1_Complete
    Log("complete")
End Sub
Sub Activity_Resume
pp.SetScreenOrientation(0)
End Sub

Sub Activity_Pause (UserClosed As Boolean)
pp.SetScreenOrientation(1)
End Sub

Any help will be appreciate it.
 

PaulR

Active Member
Licensed User
Longtime User
Sorry for the silly question, but how do we check what the scale of the video being loaded is to adjust the size and position of of the videoview if required?
 

margret

Well-Known Member
Licensed User
Longtime User
I change the size of the VideoViewExtended object. To start with I set the view to the Activity.Width and calculate the 16.9 ratio:

B4X:
'In Globals
w = Activity.Width
h = Activity.Height
vv.Width = w
vv.Height = (w/16) * 9

now to zoom:

B4X:
Sub ZoomIn
     'Zoom 10 Pixels @ a time
     vv.Left = vv.Left -10
     vv.Width = vv.Width +20
     vv.Height = vv.Height +(20/16) * 9
End Sub

This works great in ICS but not in 2.2 or 2.3.
 

vb1992

Well-Known Member
Licensed User
Longtime User

margret

Well-Known Member
Licensed User
Longtime User
Just loaded my code on the SG S2 which is 2.3.4. It works like ICS. However, when it is zoomed to larger than the screen the video plays fine but looks like it drops frames here and there(not as smooth). The other device I tried, kindle fire, will not do this at all. Must be their forked version of the OS. So it seems we have the code to do this but it will be device specific as to if it works or not and how smooth.

The last link posted above by: vb1992 from stackoverflow seems to state the same thing (some will work and others will not).
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
icemod query unresolved

Any advice on how to get rid of the icemod error?

icemod is structure as:
Type MyType( mypath As String ,playerfn As String )
Dim icemod As MyType
.....

The library work also without this of course.
This is a example complete:
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
Dim vvv As VideoViewExt
Dim w,h As Int
'Dim pp As Phone

End Sub

Sub Activity_Create(FirstTime As Boolean)
'icemod.phone1.SetScreenOrientation(0)
vvv.Initialize("vv1")
'vve.Initialize("vve")
w = Activity.Width * 1.5
h = Activity.Height * 1.5
Log(w & " " & h)

vvv.LoadVideo(File.DirRootExternal, "movie.m4v")

'Activity.AddView(vvv,0,0,Activity.Width,Activity.Height)
Activity.AddView(vvv,0,0,w,h)
vvv.Play
End Sub


Sub vv1_Complete
   Log("complete")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Top