Sub Process_Globals
Dim audioRecorder As AudioRecordApp
Dim videoRecorder As VideoRecordApp
End Sub
Sub Globals
Dim vv As VideoView
Dim vidfile As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
audioRecorder.Initialize("audioRecorder")
videoRecorder.Initialize("videoRecorder")
End If
vv.Initialize("vv")
Activity.AddView(vv, 0, 0, 100%x, 100%y)
Activity.AddMenuItem("Record Video", "RecordVideo")
Activity.AddMenuItem("Record Audio", "RecordAudio")
ToastMessageShow("Press on Menu button...", True)
End Sub
Sub RecordVideo_Click
' vidfile = File.Combine(File.DirRootExternal, "1.mp4") 'Si tienes SD
vidfile = File.Combine(File.DirDefaultExternal, "1.mp4")
' videoRecorder.Record(File.DirRootExternal, "1.mp4")
videoRecorder.Record(File.DirDefaultExternal, "1.mp4")
End Sub
Sub RecordAudio_Click
' audioRecorder.Record(File.DirRootExternal, "1.3gpp")
audioRecorder.Record(File.DirDefaultExternal, "1.3gpp")
End Sub
Sub videoRecorder_RecordComplete (Success As Boolean)
Log(Success)
If Success Then
' vv.LoadVideo(File.DirRootExternal, "1.mp4")
' vv.Play
Dim rfl As Reflector
Dim obj As Object
Dim b As Bitmap
obj = rfl.CreateObject("android.media.MediaMetadataRetriever")
rfl.Target = obj
rfl.RunMethod2("setDataSource", vidfile, "java.lang.String")
b = rfl.RunMethod3("getFrameAtTime", 0, "java.lang.long", 3, "java.lang.int")
Dim i, j, h, w As Int
Dim iv As ImageView
i = b.Height * 0.3
j = b.Width * 0.5
h = Activity.Height
w = Activity.Width
iv.Initialize("")
Activity.AddView(iv, (w - j) / 2, (h - i) / 3, j, i)
iv.Bitmap = b
End If
End Sub
Sub audioRecorder_RecordComplete (Success As Boolean)
Log(Success)
If Success Then
' vv.LoadVideo(File.DirRootExternal, "1.3gpp") 'Si tienes SD
vv.LoadVideo(File.DirDefaultExternal, "1.3gpp")
vv.Play
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub