Hello, i am trying to get image from a video. I did it when i recorded a video and went back to app, but when i use the ContentChooser i can't do this.
How can i get the image from a video after i choose this image with ContentChooser?
Here is my code to get the image after i record a video:
and code to choose an video
Thanks.
How can i get the image from a video after i choose this image with ContentChooser?
Here is my code to get the image after i record a video:
B4X:
video.Initialize("video") 'video is a process global VideoRecordApp variable.
Dim folder As String = Starter.Provider.SharedFolder
Dim FileName As String = "1.mp4"
video.Record3(folder, FileName, -1, Starter.Provider.GetFileUri(File.Combine(folder, FileName)))
Wait For Video_RecordComplete (Success As Boolean)
If Success Then
'Example of playing the recorded video
Dim vidfile As String = File.Combine(folder, FileName)
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")
icVideoMediaAtividadeSuspeitaSvBullying.Bitmap = b
ToastMessageShow("Vídeo recorded with success!", True)
End If
and code to choose an video
B4X:
Dim cc As ContentChooser
cc.Initialize("cc")
cc.show("video/*", "Choose video")
Wait For cc_Result(Success As Boolean, Dir As String, FileName As String)
If Success Then
Log("vídeo choosed- Folder: " & Dir & " file name: "&FileName)
ToastMessageShow("Video choosed with success!", True)
Else
ToastMessageShow("Video not selected!", True)
End If
Thanks.