#Region Module Attributes
#FullScreen: True
#IncludeTitle: False
#ApplicationLabel: VitamioBundle demo
#VersionCode: 1
#VersionName:
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
'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
Dim VitamioMediaController1 As VitamioMediaController
Dim VitamioVideoView1 As VitamioVideoView
Dim VV As VideoView
Dim VitOn As Int
Dim Overlay As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
' check if the VitamioBundle core is installed
' if this is the first time that the installed application has been started then the core will NOT be installed
' otherwise the core should be already installed
' if the core is NOT installed then CheckVitamioLibs returns False and this Activity's Finish method is called by the library
' the core is then installed and this Activity will be restarted
' CheckVitamioLibs will now return True and you can proceed to use the library
If VitamioVideoView1.CheckVitamioLibs Then
VitamioVideoView1.Initialize("VitamioVideoView1")
Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)
VitamioMediaController1.Initialize("VitamioMediaController1")
VitamioVideoView1.SetMediaController(VitamioMediaController1)
VitamioVideoView1.SetVideoPath("http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
End If
VitOn=1
Overlay.Initialize("overlay")
Activity.AddView(Overlay, 50dip, 50dip, 40dip, 40dip)
Overlay.Color = Colors.ARGB (100, 200, 200, 200)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If VitamioVideoView1.IsPlaying Then
VitamioVideoView1.StopPlayback
End If
End Sub
Sub VitamioVideoView1_Buffering(Percent As Int)
' Log("VitamioVideoView1_Buffering: "&Percent) ' commented out to avoid unless logging
End Sub
Sub VitamioVideoView1_Complete
Log("VitamioVideoView1_Complete")
End Sub
Sub VitamioVideoView1_Error(MEDIA_ERROR As Int) As Boolean
' this event Sub must return a Boolean value to indicate whether it has handled the error or not
' returning True will prevent the library from taking any action such as displaying an error message
Log("VitamioVideoView1_Error")
Return True
End Sub
Sub VitamioVideoView1_Info(What As Int, Extra As Int) As Boolean
' what does this event mean?
' what do the Int parameters represent?
' Log("VitamioVideoView1_Info") ' commented out to avoid unless logging
Return False ' indicates that this Sub has NOT handled the event and that the library should handle it
End Sub
Sub VitamioVideoView1_Prepared
Log("VitamioVideoView1_Prepared")
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
If KeyCode = KeyCodes.KEYCODE_MENU Then
If VitOn=1 Then
VitamioVideoView1.StopPlayback
VitamioVideoView1.RemoveView
VV.Initialize("vv")
Activity.AddView(VV, 5%x, 5%y, 90%x, 90%y)
VV.LoadVideo("http", "http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
VV.play
VitOn=2
Else
VV.Stop
VV.RemoveView
If VitamioVideoView1.CheckVitamioLibs Then
VitamioVideoView1.Initialize("VitamioVideoView1")
Activity.AddView(VitamioVideoView1, 5%x, 5%y, 90%x, 90%y)
VitamioMediaController1.Initialize("VitamioMediaController1")
VitamioVideoView1.SetMediaController(VitamioMediaController1)
VitamioVideoView1.SetVideoPath("http://r7---sn-cn3tc-ac5l.c.youtube.com/videoplayback?sver=3&expire=1374248116&itag=22&id=ad4b57f29165e967&upn=8gOITPaVVjM&cp=U0hWSVJPVl9GUENONl9KSVpCOjlpS3VzYjhtbHBt&sparams=cp,id,ip,ipbits,itag,ratebypass,source,upn,expire&mt=1374226349&mv=m&source=youtube&ms=au&ratebypass=yes&ipbits=8&fexp=916904,912506,919359,929204,929117,929121,929906,929907,929127,929129,929131,925720,925722,925718,925714,929917,929919,912521,904830,919373,904122,908534,936303,909549,900816,912711,935000,921057,929309&key=yt1&ip=90.210.142.0&signature=D73749669A867FA322383BFFA084F2146BEBE582.D1B502EC0FD3764F00A323507AF01274B5109A21")
VitamioVideoView1.SetVideoQuality(VitamioVideoView1.VIDEO_QUALITY_HIGH)
VitOn=1
End If
End If
End If
End Sub