#Region Project Attributes
#ApplicationLabel: B4A vvbuff
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
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 vv As VideoView
Dim myprogressbar As ProgressBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
vv.Initialize("vv")
Activity.AddView(vv, 0, 0, 300dip, 300dip)
myprogressbar.Initialize("")
myprogressbar.Indeterminate = True
Activity.AddView(myprogressbar,0,0,200dip,200dip)
myprogressbar.Visible = True
AddInfoHandler(vv,"VVInfo")
AddPreparedHandler(vv,"VVPrepared")
vv.LoadVideo("http", "http://download.wavetlan.com/SVV/Media/HTTP/BlackBerry.3gp")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub vv_Complete
Log("Playing completed")
End Sub
Sub AddPreparedHandler(v As VideoView, EventName As String)
Dim jo As JavaObject = v
Dim e As Object = jo.CreateEventFromUI("android.media.MediaPlayer.OnPreparedListener", EventName, True)
jo.RunMethod("setOnPreparedListener", Array(e))
End Sub
Sub VVPrepared_Event (MethodName As String,Args() As Object) As Object
Log("Prepared")
myprogressbar.Visible = False
vv.Play
Return Null
End Sub
Sub AddInfoHandler(v As VideoView, EventName As String)
Dim jo As JavaObject = v
Dim e As Object = jo.CreateEventFromUI("android.media.MediaPlayer.OnInfoListener", EventName, True)
jo.RunMethod("setOnInfoListener", Array(e))
End Sub
Sub VVInfo_Event (MethodName As String,Args() As Object) As Object
Dim what As Int = Args(1)
Log("info = constant value " & what)
If what = 701 Then 'MEDIA_INFO_BUFFERING_START
Log("my bufferindicator.visible = true")
myprogressbar.Visible = True
Else If what = 702 Then 'MEDIA_INFO_BUFFERING_END
Log("my bufferindicator.visible = false")
myprogressbar.Visible = False
End If
'Dim extra As Int = Args(2)
Return Null
End Sub