I have an APP which runs very well. It takes pictures and send them in sequence to a server via a TCP connection. I use CamEx to take pictures. The customer asked me to take a movie too and store it on the local memory. This works very well with RSVideoRecord library. I get the movie, store it and repeat the process many times. In the same app I use CamEx to take pictures and I'm able to get an unlimited number of them. But after this action, the Movie camera doesn't work since the Record_ready (after record_initialize) reports success=false. Doing the reversed action (movie camera---> take pictures) works ok!
In extended log there is no further information, no bad parameter...
The code to start the movie camera is:
This code will end the movie activity:
This is the code to start picture handling:
This code sends the pictures:
This codes terminates the pictures' acquire...
Does anybody have an aswer for such a beaviour?
Thank very much for you time...
Mauro
In extended log there is no further information, no bad parameter...
The code to start the movie camera is:
B4X:
'initialize panel1
Activity.LoadLayout("5")
record.Initialize(Panel1, "record")
Sub record_Ready (Success As Boolean)
If Success Then
Dim OS As OperatingSystem
OS.Initialize("OS")
Dim extmem As Long = OS.AvailableExternalMemorySize
Dim intmem As Long = OS.AvailableInternalMemorySize
Dim totmem As Long
If extmem >intmem Then
totmem = extmem
dirimage= File.DirDefaultExternal
Else
totmem = intmem
dirimage= File.DirInternalCache
End If
If totmem< 30000000 Then
Msgbox ("Spazio insufficiente / Few disk space", "Disk Space")
record.Release
Return
End If
Dim tottime As Double = totmem/1500000 ' ottiene i minuti
Dim dsply As String= "Rec.max minutes: " & NumberFormat2(tottime,1,3,2,False)
If sleep=False Then
setsleep_click
End If
btntakepicture.Enabled=False
record.StartPreview
'ToastMessageShow("Preview started.",False)
Try
record.unlockCamera
Catch
End Try
record.initMediaRecorder()
record.AudioSource = 5
record.VideoSource = 1
record.OutputFormat = 2
record.setScreenSize(320,240)
record.AudioEncoder = 1
record.VideoEncoder = 2
record.setOutputFile(dirimage , Mioangelo.userx)
record.setPreviewDisplay
ToastMessageShow("Initialized.",False)
record.prepare
Try
record.start
Catch
Log(LastException.Message)
End Try
'ToastMessageShow("Started.",False)
btntakepicture.Enabled=True
ToastMessageShow(dsply,True)
filma=True
Else
ToastMessageShow("Cannot open camera.", True)
Panel1.RemoveView
btntakepicture.RemoveView
End If
end sub
This code will end the movie activity:
B4X:
Sub stopvideo
record.stop
record.resetMediaRecorder
record.releaseMediaRecorder
record.lockCamera
'ToastMessageShow("Stopped.",False)
record.StopPreview
record.Release
'ToastMessageShow("Released.",False)
Panel1.RemoveView
btntakepicture.RemoveView
ToastMessageShow("Video Pronto/Video Ready",True)
If sleep=True Then
setsleep_click
End If
Activity.Title= actlabel
End Sub
This is the code to start picture handling:
B4X:
camEx.Initialize(Panel1, frontCamera, Me, "Camera1")
B4X:
Sub Camera1_Ready (Success As Boolean)
If Success Then
camEx.StartPreview
Log("Supported sizes:")
For Each size As CameraSize In camEx.GetSupportedPicturesSizes
Log(size.Width & "x" & size.Height)
Next
camEx.SetJpegQuality(90)
Log(camEx.GetSupportedFlashModes)
camEx.SetPictureSize(320,240)
camEx.CommitParameters
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
This code sends the pictures:
B4X:
Sub Camera1_Preview (PreviewPic() As Byte)
Dim jpeg() As Byte = camEx.PreviewImageToJpeg(PreviewPic, 70)
CallSubDelayed2(picturesender, "Send", jpeg) ' this sub sends the picture...
End Sub
This codes terminates the pictures' acquire...
B4X:
camEx.StopPreview
camEx.Release
Does anybody have an aswer for such a beaviour?
Thank very much for you time...
Mauro